CSS控制DIV不換行

來源:互聯網
上載者:User
nobr元素

代碼<html>
<head>
</head>
<body>
<div><nobr>不換行不換行<nobr></div>
</body>
</html>

 

 

nowrap元素

代碼<html>
<head>
</head>
<body>
<div nowrap>div不換行div不換行div不換行</div>
</body>
</html>

 

 

float屬性

代碼<html>
<head>
<style type="text/css">
div#row1 { float: left; color: blue; }
div#row2 { color: red }
</style>
</head>
<body>
<div id="row1">第一個div</div>
<div id="row2">第二個div不換行</div>
</body>
</html>

 

用CSS裡的diplay屬性

文字框<html>
<head>
<title>CSS中的不換行</title>
<style type="text/css">
div#row1 { color: blue;display: inline }
div#row2 { color: red;display: inline }
</style>
</head>
<body>
<div id="row1">第一個div</div>
<div id="row2">第二個div不要換行</div>
</body>
相關文章

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.