html - 样式选择文本溢出

标签 html css twitter-bootstrap-3

试图找出样式选择框的问题。它被包裹在一个带有背景的 div 中,以创建一个蒙版外观。

When there is too much text in the <option> it will overflow onto the button

当输入中的文本过多时,它会溢出到按钮中。

HTML:

<div class="styled-select">
    <select  class="form-control required" name="address" disabled>
        <option style="" value="">Please Select Address</option>
    </select>
</div>

CSS:

    .styled-select select {
    font-family: "Circular", Helvetica, Arial, sans-serif;
    font-size: 18px;
    background: transparent;
    width: 100%;
    padding: 15px;
    font-size: 16px;
    line-height: 1;
    border: 0;
    height: 50px;
    border-radius: 10px;
    -webkit-appearance: none;
    padding-right: 10%;
}

.styled-select { 
    width: 100%; 
    overflow: hidden; 
    background: url(../images/bg/down-arrow.jpg) no-repeat right #FFF; 
    background-size: 60px; 
    height: 50px; 
    border-radius: 10px; 
}

@media (min-width: 768px) {
    .styled-select select {
    font-family: "Circular", Helvetica, Arial, sans-serif;
    font-size: 18px;
    background: transparent;
    width: 100%;
    padding: 18px;
    font-size: 18px;
    line-height: 1;
    border: 0;
    height: 55px;
    border-radius: 10px;
    -webkit-appearance: none;
    padding-right: 10%;
}

.styled-select { 
    width: 100%; 
    overflow: hidden; 
    background: url(../images/bg/down-arrow.jpg) no-repeat right #FFF; 
    background-size: 60px; 
    height: 55px; 
    border-radius: 10px; 
}

谁能解决这个问题?

最佳答案

问题是,您在 select 本身的 css 中使用了 padding-right: 10%;。测量图像 - 选择的宽度约为 270px10%width 仅为 27px - 这是通过我的措施纠正。

要解决这个问题 - 箭头的 background-image 似乎是 60px 宽,所以使用 padding-right: 78px; (即背景图片的宽度60px18px表示您之前在移动媒体查询中设置的padding ).

关于html - 样式选择文本溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37030297/

相关文章:

javascript - document.execCommand ('copy' ) 命令在字符串的开头和结尾添加换行符

javascript - div 中的文本在 safari 8.2、chrome 39 中显示,但在 firefox 34 中不显示。为什么?

html - 在 css 中绘制一个只有边框的三 Angular 形

html - 如何将 Bootstrap bg-x(例如 bg-danger)类添加到输入文本框?

html - 如何控制下拉菜单的可见文本位置?

javascript - 引导轮播图像高度

javascript - 如何更改纸张输入 Polymer 中的下划线边框

javascript - 单击时我的 div 不会使用 js 提交其中的表单

html - BootStrap 中的响应式设计使用什么列系统

html - Bootstrap 侧边栏下的内容