text-indent Attribute | textIndent参数属性
| DHTML文档教程 |
Sets or retrieves the indentation of the first line of text in the object. dhtml语法 HTML |
{ text-indent : sIndent }
|
---|
Scripting | object.style.textIndent [ = sIndent ] |
---|
DHTML可能的值 sIndent | Variant that
specifies or receives one of the following values:length | Floating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). For more information about the supported length units, see css length units reference. | percentage | Integer, followed by a percent sign (%). This value is a percentage of the width of the parent object. |
|
The property is read/write
for all objects except the following, for which it is read-only:
currentStyle.
The property has a default value of
0. The Cascading Style Sheets (CSS) attribute is
inherited.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks the property can be negative. an indent is not inserted in the middle of an object that was broken by another object, such as br in html.
Examples
The following examples use the text-indent attribute and the textIndent property to indent the object's text.
This example uses calls to an embedded style sheet to change the indent on the text when an onclick event occurs. the text was originally indented 2 centimeters using div as a selector in the style sheet. <STYLE>
DIV { text-indent:2cm }
.click1 { text-indent:50% }
.click2 { text-indent: }
</STYLE>
</HEAD>
<BODY>
<DIV onclick="this.className='click1'"
ondblclick="this.className='click2'">
. . . </DIV> This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
This example uses inline scripting to indent the text within the div when an onmouseover event occurs. <div onmouseover=this.style.textindent="2cm"
:
</DIV> This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample. 是否符合公共标准
This property is defined in
Cascading Style Sheets (CSS), Level 1 (CSS1) .
Applies To |
BLOCKQUOTE,
BODY,
BUTTON,
CENTER,
currentStyle,
DD,
DFN,
DIR,
DIV,
DL,
DT,
FIELDSET,
FORM,
hn,
HR,
ISINDEX,
LI,
LISTING,
MARQUEE,
MENU,
OL,
P,
PLAINTEXT,
PRE,
runtimeStyle,
style,
TABLE,
TD,
TH,
TR,
UL,
XMP | |
|