Home >Web Front-end >HTML Tutorial >html element forces no line breaks_html/css_WEB-ITnose

html element forces no line breaks_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:45:031193browse

html nowrap is used to force no line breaks

  • In typesetting
    use the nowrap attribute on tags that wrap plain text to instantly force no line breaks Line break.
    For example:

    Force no line break


    Force no line break

  • In hypertext using div

    Force elements such as div, h1, section, nav, a, li to become inline elements
    display:inline;
    Then you can operate it like the first case.

  • Example: The ul element is forced not to wrap under the parent nav width limit

    Make the sub-tag ul itself have the width of wrap-content (borrowing the key adjective of android layout)
    nav>ul>li*10>a[href='#']{random link$}
    nav{ fixed width width:40em; nowrap attribute white-space:nowrap; }
    ul,li,a{ inline element display:inline; eliminate floating float:none; }
    // It is necessary for li to become inline
    When ul is not inline, the maximum width of ul itself is the width of the parent nav;
    When ul is inline, the width of ul is the wrap-content width.
    See my navigation for demo

    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn