开发者

CSS: different certain width for child elements

I've got unordered-list.

How i can set different width property for each child of ul, if there is no way to set class or id property for li? Final result should be something like this:

/**52px**/ /**100px**//**92px**/ /**150px**/


Use CSS3 here is a good info about what you need :nth-child(). For fail safety, because not every browser supports CSS3, in addition you can assign id with a property to the elements of ul.


Agree with Bakudan, it works

-- HTML

  • Home
  • Blog
  • About
  • Contact
  • -- CSS

    .menu li:nth-child(1){
    color:green;
    width:52px;    
    }
    

    Have a look here : http://jsfiddle.net/geekonweb/WZEGk/

    0

    上一篇:

    下一篇:

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    最新问答

    问答排行榜