[英]Different CSS in Mac and Windows Browsers
This has been plaguing me for awhile now and I can't seem to figure it out. 这已经困扰了我一段时间了,我似乎无法弄清楚。 I have the below code creating these red circles with plus signs in them. 我有以下代码创建带有加号的红色圆圈。 On a PC they look great (all major browsers) and on a Mac they look horrible on all major browsers. 在PC上,它们看起来很棒(在所有主流浏览器上),在Mac上,它们在所有主流浏览器上看起来都很恐怖。 I'd like to not modify my CSS based on the user agent because that feels hacky and I know there is a way to get every browser to agree on how to display it. 我不想基于用户代理修改CSS,因为这感觉很hacky,而且我知道有一种方法可以使每个浏览器都同意如何显示它。
Any help is truly appreciated. 任何帮助,我们都感激不尽。
On a PC: 在PC上:
PC Screenshot http://www.drury.edu/rue/windows_screenshot.png PC屏幕截图http://www.drury.edu/rue/windows_screenshot.png
On a Mac: 在Mac上:
PC Screenshot http://www.drury.edu/rue/mac_screenshot.png PC屏幕截图http://www.drury.edu/rue/mac_screenshot.png
Markup: 标记:
<ul class="sectionLinkHeading">
<li class="sidebarHeading" id="sidebarHeading0">
<span>Program Overview</span>
<div class="sidebarPlus" id="sidebarPlus0"></div>
</li>
</ul>
CSS: CSS:
.sidebarPlus
{
box-sizing: border-box;
float: right;
width: 23px;
height: 24px;
margin-top: 13px;
margin-right: 8px;
padding-left: 6px;
background: #CB2E32;
border-radius: 50%;
color: #FFF;
font-size: 20px;
font-family: Museo-300;
font-weight: 500;
}
.sidebarPlus:after
{
content: "+";
clear: both;
}
If you need any more information I'd be happy to share. 如果您需要更多信息,我很乐意与您分享。 Unfortunately I cannot provide a live link as this site currently only has an internal IP. 不幸的是,由于该站点当前只有内部IP,因此我无法提供实时链接。
Use position:relative
on the parent .sidebarPlus
and position:absolute
on the pseudo .sidebarPlus:after
then set left
and top
. 在父.sidebarPlus
上使用position:relative
,在伪.sidebarPlus:after
上使用position:absolute
,然后设置left
和top
。
.sidebarPlus
{
box-sizing: border-box;
float: right;
width: 23px;
height: 24px;
margin-top: 13px;
margin-right: 8px;
padding-left: 6px;
background: #CB2E32;
border-radius: 50%;
color: #FFF;
font-size: 20px;
font-family: Museo-300;
font-weight: 500;
position:relative;
}
.sidebarPlus:after
{
content: "+";
clear: both;
position:absolute;
left:2px;
top:2px;
}
or just add this +
或仅添加此+
<ul class="sectionLinkHeading">
<li class="sidebarHeading" id="sidebarHeading0">
<span>Program Overview</span>
<div class="sidebarPlus" id="sidebarPlus0">+</div>
</li>
</ul>
and the use position relative to .sidebarHeading
and position absolute to sidebarPlus
and remove .sidebarPlus:after
to your css 相对于使用位置.sidebarHeading
和位置绝对以sidebarPlus
和删除.sidebarPlus:after
你的CSS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.