我正面临着这个问题。 CSS代码100%相同。不受任何其他代码的干扰。
代码:
.items a {
font-size: 12px;
text-transform: lowercase;
display: inline-block;
border: 1px solid #CCC;
line-height: 1;
padding: 3px 5px;
border-radius: 25px;
color: #C0BEBE;
}
<div class="items">
<a href="http://example.com/tag/art-design/">Art & Design</a>
<a href="http://example.com/tag/bamboo/">bamboo</a>
<a href="http://example.com/tag/fancy/">fancy</a>
<a href="http://example.com/tag/tags/">tags</a>
<a href="http://example.com/tag/waqas/">waqas</a>
</div>
答案 0 :(得分:1)
尝试将margin
添加到您的规则中,以使其保持持久性。现在它使用浏览器定义的样式。而且,是的,您可以,请提供您的HTML以及您正在检查的浏览器。
或者,你可以使用一些reset.css,比如这个:http://meyerweb.com/eric/tools/css/reset/
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
答案 1 :(得分:1)
刚尝试在没有进一步信息的情况下构建完整的Demo。让我知道它是否适合你。
检查 DEMO 。
CSS代码
ul{margin:0; padding:0; width:240px;text-align:center;}
li{list-style-type:none; padding:4px;display: inline-block;
}
.items a {
font-size: 16px;
text-transform: lowercase;
display: inline-block;
border: 1px solid #CCC;
line-height: 1;
padding: 3px 5px;
border-radius: 15px;
color: #C0BEBE;
text-decoration:none;
min-width:30px;
text-align:center;
}
HTML代码
<ul>
<li class="items"><a href="#">Art & Design</a></li>
<li class="items"><a href="#">Bamboo</a></li>
<li class="items"><a href="#">Fancy</a></li>
<li class="items"><a href="#">Tag</a></li>
<li class="items"><a href="#">Waqas</a></li>
</ul>
答案 2 :(得分:1)
好的,我想通了。
我将容器的行高(在我的情况下为.items)设置为1,现在两个页面的结果都相同。
.items {line-height: 1}
答案 3 :(得分:0)