HTML DOM whiteSpace ÊôÐÔ

HTML DOM Style ¶ÔÏó

¶¨ÒåºÍÓ÷¨

whiteSpace ÊôÐÔÉèÖÃÈçºÎ´¦ÀíÎı¾ÖеĿհ׷û£¨±ÈÈç¿Õ¸ñºÍ»»Ðзû£©¡£

Óï·¨£º

Object.style.whiteSpace=normal|nowrap|pre

¿ÉÄܵÄÖµ

Öµ ÃèÊö
normal ĬÈÏ¡£¿Õ°×»á±»ä¯ÀÀÆ÷ºöÂÔ¡£
pre ¿Õ°×»á±»ä¯ÀÀÆ÷±£Áô¡£ÆäÐÐΪ·½Ê½ÀàËÆ HTML ÖÐµÄ <pre> ±êÇ©¡£
nowrap Îı¾²»»á»»ÐУ¬Îı¾»áÔÚÔÚͬһÐÐÉϼÌÐø£¬Ö±µ½Óöµ½ <br> ±êǩΪֹ¡£

ʵÀý

±¾Àý²»ÔÊÐíÔÚÎı¾ÄÚ»»ÐУº

<html>
<head>
<script type="text/javascript">
function removeWrapping()
{
document.getElementById("div1").style.whiteSpace="nowrap";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="removeWrapping()" 
value="Do not let the text wrap" />

</body>
</html>

HTML DOM Style ¶ÔÏó

VUE