• ....
  • ....
  • .... ...">
    Geek asks and answers

    What is the most appropriate HTML5 element to use for "clear: both;" Goals?

    I have:

    <section>
        <ul>
            <li>....</li>
            <li>....</li>
            <li>....</li>
            ..
        </ul>
    </section>
    

    I want to <li>float to the left and at the end of these <li>, right after </ul>I needed to place an element of how clear: both;to preserve the integrity of the block section.

    Which html5 element would be most suitable for this purpose? Should I follow the invisible hr? a div?

    Thank.

    +5
    html css html5 css3
    Phil May 12, '12 at 11:29
    source share
    2 answers

    No , use a trick if necessary overflow: hidden.

    If this does not fit, use a pseudo-element. For example, you can use ...

    ul:after { 
        content: "";
        clear: both;
        display: block;
    } 
    
    +5
    alex May 12, '12 at 11:32
    source share

    You can use . clearfix for this. Write like this:

    ul:after{
     content:'';
     display:block;
     clear:both;
    }
    
    +3
    sandeep 12 '12 11:33

    More articles:

    • Replacing characters in a file - python
    • Call Java logging method? - java
    • Change regex delimiter in awk patterns - regex
    • Использование ScalaTest для тестирования акк-актеров - scala
    • nodejs - Why can Node.js handle a large number of concurrent persistent connections? - node.js
    • How can I stretch the background in the whole window? - javascript
    • Eclipse Maven Plugin Versions - eclipse
    • How does the javascript dart compiler (dart2js) work? - compiler-construction
    • Text does not wrap inside UL LI A - css
    • Getting function arguments with kprobes - assembly

    All Articles

    Geek-Ask | 2020