[英]HTML / CSS : create a horizontal block list forcing width of the li elements
I have a horizontal list which is fine. 我有一份水平清单,可以。 The image is shown below. 图像如下所示。 The list right under the header is the list im talking about. 标题下面的列表就是我正在谈论的列表。 What I want to achieve is basically you see each links wording is all in one line, eg "Mash's Famous Wings" Well what im trying to do is create a fixed height and width (same for all) for all the li elements in the list. 我要实现的基本上是看到每个链接的措辞都在一行中,例如“ Mash's Famous Wings”。嗯,我想做的是为列表中的所有li元素创建一个固定的高度和宽度(对于所有元素而言都是相同的) 。 So this means that some of the words will go down into a new line. 因此,这意味着某些单词将落入新的一行。
See Smokey Bones Menu Sub Navigation as an example. 例如,请参见烟熏骨头菜单子导航 。
This is my CSS so far: 到目前为止,这是我的CSS:
#menunavigation{
position:fixed;
top:100px;
left:50px;
z-index:1;
color:white;
}
#menunavigation a {
color:white;
}
#menunavigation ul{
list-style-type:none;
height:50px;
}
#menunavigation ul li{
display:inline;
max-width:15px;
margin-right:5px;
}
Try updating your css code with this snippet. 尝试使用此代码段更新您的CSS代码。
#menunavigation ul li
{
display:inline-block;
max-width:15px;
margin-right:5px;
}
however, display:inline-block
will not work in IE-7, you need to include these extra lines, kind of hack which will work only in IE-7. 但是, display:inline-block
在IE-7中不起作用,您需要包括这些额外的行,这种hack仅在IE-7中起作用。
*display:inline;
*zoom:1;
or else if you are supporting IE-7 full time, you can detect it using contional comments. 否则,如果您全职支持IE-7,则可以使用条件注释来检测它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.