Try to search your question here, if you can't find : Ask Any Question Now ?

clear property not working on nth-child selector

HomeCategory: stackoverflowclear property not working on nth-child selector
Avatarwillson asked 4 months ago

It may seem basic but, clear:both; is not working on my li tag when i am using nth-child() selector.

li{
    display: block;
    width:100px;
    height: 100px;
    list-style-type: none;
    margin:1px;
    float: left;
}
li:nth-child(1){
    background:#ff0000;
    clear:both;
}
li:nth-child(even){
    background: #0000ff;
}

But it work’s perfectly fine when used in main li tag.

<body>
    <li></li>
    <li></li>
</body>

code does not work even when I use div instead on li.

1 Answers
Best Answer
AvatarArben answered 4 months ago
Your Answer

7 + 12 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com