UL是否有默认的边距或填充 [英] Does UL have default margin or padding
问题描述
这可能看起来像一个愚蠢的问题,但我已经将UL添加到基本页面,并且该列表似乎是偏离中心的。这份清单没有什么特别之处。没有添加特定的CSS:只是一个列表。当我加载直播时,它的位置偏离了中心位置。
左侧是否有默认边距或填充值?
< h3>标题标题< / h3>
< ul id =listItems>
< li> itemOne< / li>
< li> itemTwo< / li>
< li> itemThree< / li>
< / ul>
主体具有用于居中,对齐,浮动等的所有css代码。
'标题标题'完美对齐。
哦,不知道这是否重要,但我添加了'id',因为...想要使用'first-type-type'来给第一个项目em(粗体)。
问题是,默认情况下,浏览器具有自定义css - 例如chrome。
ul,菜单,dir {
display:block;
list-style-type:disc;
-webkit-margin-before:1em;
-webkit-margin-after:1em;
-webkit-margin-start:0px;
-webkit-margin-end:0px;
-webkit-padding-start:40px;
$ / code>
您必须为您的 ul
:
element.style {
margin-left:0px;
/ *如果不使用list-style-type * /
padding-left:20px,则设置为0。
}
This might seem like a dumb question, but I've added an UL to a basic page and the list seems to be off-centered. There's nothing special about the list. No specific css added: just a list. When I load live it's slightly off center.
Is there a default margin or padding on the left side?
<h3>Title Heading</h3>
<ul id="listItems">
<li>itemOne</li>
<li>itemTwo</li>
<li>itemThree</li>
</ul>
The main body has all the css code for centering, aligning, float, etc. The 'Title Header' align perfectly. Just list is a little off.
Thank you.
Oh, don't know if this is important, but I added the 'id' cause... wanted to use 'first-of-type' to give 1st item em(bold).
The problem is that by default, browsers have custom css - in chrome for example:
ul, menu, dir {
display: block;
list-style-type: disc;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
-webkit-padding-start: 40px;
}
You'll have to use a custom rule for your ul
:
element.style {
margin-left: 0px;
/* set to 0 if your not using a list-style-type */
padding-left: 20px;
}
这篇关于UL是否有默认的边距或填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!