我正在處理移動網站的動態HTML列表。基本概念有效,但我想刪除列表側面的間距。我嘗試過margin-left
和padding-left
,但它仍然不起作用。刪除HTML列表中的縮進
例子:
/* Now */
List1
List2
List3
/* And I want */
List1
List2
List3
我正在處理移動網站的動態HTML列表。基本概念有效,但我想刪除列表側面的間距。我嘗試過margin-left
和padding-left
,但它仍然不起作用。刪除HTML列表中的縮進
例子:
/* Now */
List1
List2
List3
/* And I want */
List1
List2
List3
聽起來像是你需要從列表中的項目容器(ul
,ol
或menu
)刪除padding
:
ul {
padding-left:0;
}
刪除文件'padding' /'margin'符合UL {填充左:0 ;}它的工作原理,我不知道爲什麼我沒有嘗試它......謝謝你們! – Azuken 2013-03-20 07:38:19
單從UL取出填充:
ul {padding-left:0}
我猜這可能意味着你還沒有建立一個css重置爲好,把這個在你的CSS文件的頂部:
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;
}
我不建議在每個項目中使用CSS重置樣式。許多設計者通常習慣於(當他們使用基本HTML時),例如'
我在每個項目中都使用一個。每個元素/規則都有一個標準值,但是這在瀏覽器和瀏覽器中是不同的。如果可以輕鬆設置樣式,我寧願不相信自己的樣式默認可以是任意數量的瀏覽器之一。 – Alex 2013-03-18 16:19:27
有關此處的更多信息:http://stackoverflow.com/questions/167531/is-it-ok-to-use-a-css-reset-stylesheet – Alex 2013-03-18 16:22:15
計算樣式上的Safari爲<ul>
display: block;
font-family: 'Lucida Grande', Arial, Helvetica;
font-size: 12px;
height: 30px;
list-style-type: disc;
margin-bottom: 12px;
margin-left: 0px;
margin-right: 0px;
margin-top: 12px;
padding-bottom: 0px;
padding-left: 40px;
padding-right: 0px;
padding-top: 0px;
width: 795px;
對於在<li>
(因爲你可以看到,大多是從父母繼承<ul>
)
display: list-item;
font-family: 'Lucida Grande', Arial, Helvetica;
font-size: 12px;
height: 15px;
list-style-type: disc;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
text-align: -webkit-auto;
width: 795px;
填充左(inherrited太);
padding-left: 40px;
它設置爲較低值:
padding-left: 0px;
嘗試從'ul'不是從'li' – DoubleYo 2013-03-18 15:59:48