List items run outside of list and div area

感情迁移 提交于 2019-12-21 07:55:43

问题


I'm having an issue with a menu un-ordered list. Whereby the list items are over running the <ul> and <div> boundaries and only starting the next line once it has reach the edge of the screen.

Heres the website: http://finalonline.co.uk/mypics/gallery/categories/


回答1:


You can use float: left; on the lis instead of display: inline;.

Just remember to also use overflow: hidden; on the parent element (the ul).

Another option would be to use: display: inline-block, but I'm not 100% sure about the browser support.




回答2:


Do display: block; always... Never do display: inline; or display: inline-block;

To fix the Unordered List from pouring out of the DIV, try going into the CSS and apply this:

ul {
list-style-position: inside;
}



回答3:


Make them display: block, not inline.




回答4:


To fix the Unordered List from pouring out of the DIV, I would suggest going into the CSS and adding a min-width.

so, for example if your parent has a width:600px give the , within that div, a class and set a min-width:600px and this will keep the

  • items from stacking on top of one another and spilling outside the parent . worked for me.

    来源:https://stackoverflow.com/questions/8730803/list-items-run-outside-of-list-and-div-area

  • 易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!