开发者

CSS: different certain width for child elements

开发者 https://www.devze.com 2023-03-31 18:10 出处:网络
I\'ve got unordered-list. Home Blog About 开发者_运维知识库Contact 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?

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

    精彩评论

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