UL不要停留在他们含有的DIVs? [英] UL don't stay within their containing DIVs?

查看:94
本文介绍了UL不要停留在他们含有的DIVs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的设置

 < div class =container 
< ul>
< li>第一项< / li>
< li>第二项< / li>
< / ul>
< / div>

我假设ul的所有内容和项目符号都在div内,



UL的项目符号出现在div之外,并在溢出被隐藏时有效消失。



对我来说这是有点破坏和跨浏览器兼容,我扫描了HTML规格,但没有找到任何说明这应该发生。



解决方案



您将需要使用 list-style-position

  ul {
list-style-position:inside;
}


I have a really simple set up

<div class="container">
  <ul>
    <li>Item one</li>
    <li>Item two</li>
  </ul>
</div>

I had assumed that all contents and the bullets of the ul would be within the div but currently this is not the case.

The bullet points for the UL appear outside of the div and effectively disappear when overflow is hidden.

To me this is somewhat broken and cross browser compatible, and I've scanned the HTML spec but couldn't find anything saying this should happen.

Is there a CSS fix for it or a possible layout fix?

Thanks in advance.

解决方案

You'll want to use list-style-position:

ul {
   list-style-position: inside;
}

这篇关于UL不要停留在他们含有的DIVs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆