CSS边框显示问题,不能正常工作同样与Chrome和Safari

问题描述:

我有一个虚线框一个div,它的边框显示为在Chrome 9号线(虚线),并在Safari 5线(虚线)。这是它的CSS。CSS边框显示问题,不能正常工作同样与Chrome和Safari

.dashedLines:after { 
 
     content: ''; 
 
     display: block; 
 
     border-bottom: 4px dashed #b7b2b3; 
 
     position: absolute; 
 
     left: 50%; 
 
     top: 84px; 
 
     width: 108px; 
 
     margin-left: -45px; 
 
    }
<div class="dashedLines"> 
 
    <figure class="icon"> 
 
    <i> 
 
    <img src="{{imgs.icon_left}}" alt="Icon pencil black " /> 
 
    </i> 
 
    </figure> 
 
    <figure class="icon"> 
 
    <i> <img src="{{imgs.icon_right}}" alt="Icon descktop black " /> </i> 
 
    </figure> 
 
    </div>

它的工作原理是这样的Safari: Safari browser

它的工作原理是这样的Chrome: Chrome

我需要虚线工作一样在Safari与铬。

+1

请包括相应的HTML代码..... –

+1

破折号究竟如何看待,主要是取决于浏览器... – CBroe

+0

这显然得到不同的每个浏览器解析!你需要有相同数量的行吗? –

如果你想获得相同数量的不同浏览器的线,那么你就不能使用border属性。你应该使用一些其他技术来获得所需的输出。

如果你的破折号应该水平对齐,那么你可以使用下面的代码,

background-image: linear-gradient(to right, black 33%, rgba(255,255,255,0) 0%); 
background-position: bottom; 
background-size: 20px 4px; 
background-repeat: repeat-x; 

如果短线应对准垂直,那么你可以使用下面的代码,

background-image: linear-gradient(black 33%, rgba(255,255,255,0) 0%); 
background-position: right; 
background-size: 20px 4px; 
background-repeat: repeat-y; 

.dashed-border img { 
 
    background-image: linear-gradient(to right, black 33%, rgba(255, 255, 255, 0) 0%); 
 
    background-position: bottom; 
 
    background-size: 20px 1px; 
 
    background-repeat: repeat-x; 
 
    padding-bottom: 10px; 
 
}
<div class="dashedLines"> 
 
    <figure class="icon"> 
 
    <i> 
 
     <img src="{{imgs.icon_left}}" alt="Icon pencil black " /> 
 
     </i> 
 
    </figure> 
 
    <figure class="icon dashed-border"> 
 
    <i> <img src="{{imgs.icon_right}}" alt="Icon descktop black " /> </i> 
 
    </figure> 
 
</div>

找到fiddler供您参考。

+0

我需要用我的CSS一起添加这个的? – Bhrungarajni

+0

检查提琴手 –

+0

亚,但我需要它不来,请大家帮忙 – Bhrungarajni