我正在为项目使用Bootstrap 4砌块卡布局,在该项目中,我有<select>
具有自定义样式。部分自定义样式是使用:after
使用CSS制作的插入符号。不同的浏览器给我不同的结果,我想在这里发布,以防有人有解决方案。我不确定这是一个Bootstrap问题还是一个CSS规范问题,所以也许有人可以在那里发光。
这是Codepen链接:http://codepen.io/derekshull/pen/GZQaRY
.select-fancy {
display: inline-block;
border: 1px solid #bac2c6;
position: relative;
padding: 5px 10px;
border-radius: 20px;
width: 100%;
overflow: hidden;
color: #656565;
box-shadow: inset 0 -2px 5px rgba(255, 255, 255, 0.4);
background: #eee;
}
.select-fancy,
.select-fancy > * {
cursor: pointer;
}
.select-fancy select {
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
background: transparent;
border: 0;
outline: 0;
text-shadow: 1px 1px rgba(255, 255, 255, 0.7);
font-size: 14px;
width: calc(100% - 23px);
-webkit-user-select: none;
-moz-user-select: -moz-none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-appearance: none;
-moz-appearance: radio-container;
appearance: none;
float: left;
padding-left: 5px;
}
.select-fancy:after {
content: '';
display: block;
white-space: nowrap;
position: absolute;
width: 0;
height: 0;
right: 11px;
top: 50%;
margin-top: -4px;
border-width: 8px 6px;
border-style: solid;
pointer-events: none;
border-color: #656565 transparent transparent transparent;
}
.select-fancy img {
width: 17px;
height: 17px;
float: left;
margin-top: 1px;
}
@media (max-width: 595px) {
.card-columns {
-webkit-column-count: 1;
-moz-column-count: 1;
column-count: 1;
}
}
@media (min-width: 596px) and (max-width: 991px) {
.card-columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
}
&#13;
<section class="card-columns">
<div class="card card-block">
<h2 class="card-title"><a href="#">Card Title</a></h2>
<p class="card-text"></p>
<fieldset class="clearfix">
<div class="select-fancy">
<select class="urlSelect" data-projectid="12">
<option value="Homepage">Homepage</option>
<option value="Board Members">Board Members</option>
<option value="Events">Events</option>
</select>
</div>
</fieldset>
</div>
<div class="card card-block">
<h2 class="card-title"><a href="#">Card Title</a></h2>
<p class="card-text"></p>
<fieldset class="clearfix">
<div class="select-fancy">
<select class="urlSelect" data-projectid="12">
<option value="Homepage">Homepage</option>
<option value="Board Members">Board Members</option>
<option value="Events">Events</option>
</select>
</div>
</fieldset>
</div>
<div class="card card-block">
<h2 class="card-title"><a href="#">Card Title</a></h2>
<p class="card-text"></p>
<fieldset class="clearfix">
<div class="select-fancy">
<select class="urlSelect" data-projectid="12">
<option value="Homepage">Homepage</option>
<option value="Board Members">Board Members</option>
<option value="Events">Events</option>
</select>
</div>
</fieldset>
</div>
</section>
&#13;
答案 0 :(得分:0)
显然删除溢出:隐藏;修复一切。奇怪的是它会这样做。仍然好奇为什么会这样。