White-space Norma nowrap Force all text text to be displayed in the same row, so that all the text is displayed in a row without wrapping

Source: Internet
Author: User
Tags html br

Everyday we want to let the text content in a line, even if the width is not enough to wrap, we can use the White-space style, but if we encounter the HTML BR forced line-wrapping label, whether set white-space or not will be <br> force line wrapping.

Yesterday, the title of Na sister to do the scroll, I read the JS also wrote a, the results found that the dead or alive is not rolling, this morning found that there is a piece of CSS code did not see, this CSS code is particularly important,

There is one attribute:

White-space:nowrap;

2, White-space parameters:
Normal: Default processing mode
NoWrap: Forces all text to be displayed on the same line until the text ends or encounters a BR tag object before wrapping. DIVCSS5 recommended to use White-space:nowrap to force no line break

Article Source: http://www.divcss5.com/rumen/r401.shtml

The scrolling code is attached as follows:

        <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312" /><title>Untitled Document</title><styletype= "Text/css">#scrollobj01, #scrollobj02{White-space:nowrap;Overflow:Hidden;width:390px;}</style></Head><Body><Div><Divclass= "Gdxw"style= "width:510px; margin-top:3px;">            <imgsrc= "Images/gdxl_tp2.gif"width= "+"Height= "All"style= "Float:left;" />            <DivID= "Scrollobj01"onmouseover= "javascript:_stop01 ();"onmouseout= "javascript:_start01 ();"style= "float:left; width:390px; font-size:14px; font-family: ' The song body '; color: #ff0214;"> Living, living, living, living, living, living, living and life.<ahref= "${document.filename}?id=${document.id}"Target= "_blank"style= "color: #FF0214;"><b>${document.title}</b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                </#list>            </Div>            <Scriptlanguage= "JavaScript"type= "Text/javascript">            <!--                        functionscroll01 (obj) {/*Go left*/                vartmp=(Obj.scrollleft)++; //When the scroll bar reaches the top right                if(Obj.scrollleft==tmp) {obj.innerhtml+=obj.innerhtml; }                //scroll bar back to leftmost when scroll bar scrolls the width of initial content                if(Obj.scrollleft>=obj.firstChild.offsetWidth) {obj.scrollleft= 0; }            }            var_timer=SetInterval ("scroll01 (document.getElementById (' scrollobj01 '))", Ten); function_stop01 () {if(_timer!= NULL) {clearinterval (_timer); }            }            function_start01 () {_timer=SetInterval ("scroll01 (document.getElementById (' scrollobj01 '))", Ten); }                        // -            </Script>        </Div>        </Div></Body></HTML>

Take a closer look at someone's code

White-space Norma nowrap Force all text text to be displayed in the same row, so that all the text is displayed in a row without wrapping

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.