Definition and Usage
The overflow attribute specifies what happens when content overflows the element box.
Description
This attribute defines how content that overflows the element's content area will be handled. If the value is scroll, the user agent provides a scrolling mechanism whether required or not. Therefore, it is possible that scrollbars will appear even if everything fits inside the element box.
overflow attribute value:
1.visible: default value. The content will not be trimmed and will be rendered outside the element box.
2.hidden: The content will be trimmed and the rest of the content will be invisible.
3.scroll: The content will be trimmed, but the browser will display scroll bars to view the rest of the content.
4.auto: If content is trimmed, the browser displays scroll bars to view the rest of the content.
5.inherit: Specifies that the value of the overflow attribute should be inherited from the parent element.
Summary: visible and hidden are opposites in the overflow attribute value, and scroll and auto are opposite. Inherit is to inherit the overflow attribute value of the parent element, and the default is scroll.
Scenario: The text box is used to express opinions. The scroll bar is not displayed and when the content overflows the given display space, no more text can be entered.
Code:
Html代码 <table border=1 cellspacing=0 cellpadding=0> <tr> <td colspan="4" align="left" height="40px" style="FONT-FAMILY: 宋体; FONT-SIZE: 12pt;"> <table border=0 cellspacing=0 cellpadding=0 width=100%> <tr> <td colspan=2> 审计单位意见: </td> </tr> <tr> <td colspan=2> <textarea rows="8" cols="120" style="overflow: hidden"></textarea> </td> </tr> <tr> <td width="44%"> </td> <td style="padding-left: 100px;"> <input type="text" size="8" maxsize="4" align="center" style="border: none;"> 年 <input type="text" size="4" maxsize="2" align="center" style="border: none;"> 月 <input type="text" size="4" maxsize="2" align="center" style="border: none;"> 日 </td> </tr> </table> </td> </tr> </tr> <tr> <td colspan="4" align="left" height="40px" style="FONT-FAMILY: 宋体; FONT-SIZE: 12pt;"> <table border=0> <tr> <td> 发包人意见: </td> </tr> <tr> <td colspan=2> <textarea rows="8" cols="120" style="overflow: hidden;"></textarea> </td> </tr> <tr> <td width="44%"> </td> <td style="padding-left: 100px;"> <input type="text" size="8" maxsize="4" align="center" style="border: none;"> 年 <input type="text" size="4" maxsize="2" align="center" style="border: none"> 月 <input type="text" size="4" maxsize="2" align="center" style="border: none"> 日 </td> </tr> </table> </td> </tr> </table>