📄 dom_obj_style.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML DOM Style object</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>HTML DOM Style Object</h1>
<hr />
<h2>Style object</h2>
<p>The Style object represents an individual style statement. The Style object
can be accessed from the document or from the elements to which that style is
applied.</p>
<p><b>Syntax for using the Style object properties:</b></p>
<table class="ex" cellspacing="0" border="1" width="100%" id="table2">
<tr>
<td>
<pre>document.getElementById("<i>id</i>").style.<i>property</i>="<i>value</i>"</pre>
</td>
</tr>
</table>
<p><b>The Style object property categories:</b></p>
<table cellspacing="0" border="0" width="100%" id="table2">
<tr>
<td>
<ul>
<li><a href="#background">Background</a></li>
<li><a href="#border">Border and Margin</a></li>
<li><a href="#layout">Layout</a></li>
<li><a href="#list">List</a></li>
<li><a href="#misc">Misc</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="#positioning">Positioning</a></li>
<li><a href="#printing">Printing</a></li>
<li><a href="#scrollbar">Scrollbar</a></li>
<li><a href="#table">Table</a></li>
<li><a href="#text">Text</a></li>
<li><a href="#std">Standard</a></li>
</ul>
</td>
</tr>
</table>
<p><b>IE:</b> Internet Explorer, <b>M:</b> Mac IE only,
<b>W:</b> Windows IE only, <b>F:</b> Firefox, <b>O:</b> Opera, <b>W3C:</b>
World Wide Web Consortium (Internet Standard).</p>
<h3><a name="background">Background properties</a></h3>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th width="30%" valign="top" align="left">Property</th>
<th width="50%" valign="top" align="left">Description</th>
<th width="5%" valign="top" align="left">IE</th>
<th width="4%" valign="top" align="left">F</th>
<th width="4%" valign="top" align="left">O</th>
<th width="7%" valign="top" align="left">W3C</th>
</tr>
<tr>
<td valign="top"><a href="prop_style_background.asp">background</a></td>
<td valign="top">Sets all background properties in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundattachment.asp">backgroundAttachment</a></td>
<td valign="top">Sets whether a background-image is fixed or scrolls with
the page</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundcolor.asp">backgroundColor</a></td>
<td valign="top">Sets the background-color of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundimage.asp">backgroundImage</a></td>
<td valign="top">Sets the background-image of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundposition.asp">backgroundPosition</a></td>
<td valign="top">Sets the starting position of a background-image</td>
<td valign="top">4</td>
<td valign="top">No</td>
<td valign="top">No</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundpositionx.asp">backgroundPositionX</a></td>
<td valign="top">Sets the x-coordinates of the backgroundPosition
property</td>
<td valign="top">4</td>
<td valign="top">No</td>
<td valign="top">No</td>
<td valign="top">No</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundpositiony.asp">backgroundPositionY</a></td>
<td valign="top">Sets the y-coordinates of the backgroundPosition
property</td>
<td valign="top">4</td>
<td valign="top">No</td>
<td valign="top">No</td>
<td valign="top">No</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_backgroundrepeat.asp">backgroundRepeat</a></td>
<td valign="top">Sets if/how a background-image will be repeated</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
</table>
<h3><a name="border">Border and Margin properties</a></h3>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th width="30%" valign="top" align="left">Property</th>
<th width="50%" valign="top" align="left">Description</th>
<th width="5%" valign="top" align="left">IE</th>
<th width="4%" valign="top" align="left">F</th>
<th width="4%" valign="top" align="left">O</th>
<th width="7%" valign="top" align="left">W3C</th>
</tr>
<tr>
<td valign="top"><a href="prop_style_border.asp">border</a></td>
<td valign="top">Sets all properties for the four borders in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderbottom.asp">borderBottom</a></td>
<td valign="top">Sets all properties for the bottom border in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderbottomcolor.asp">borderBottomColor</a></td>
<td valign="top">Sets the color of the bottom border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderbottomstyle.asp">borderBottomStyle</a></td>
<td valign="top">Sets the style of the bottom border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderbottomwidth.asp">borderBottomWidth</a></td>
<td valign="top">Sets the width of the bottom border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_bordercolor.asp">borderColor</a></td>
<td valign="top">Sets the color of all four borders (can have up to four
colors)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderleft.asp">borderLeft</a></td>
<td valign="top">Sets all properties for the left border in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderleftcolor.asp">borderLeftColor</a></td>
<td valign="top">Sets the color of the left border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderleftstyle.asp">borderLeftStyle</a></td>
<td valign="top">Sets the style of the left border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderleftwidth.asp">borderLeftWidth</a></td>
<td valign="top">Sets the width of the left border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderright.asp">borderRight</a></td>
<td valign="top">Sets all properties for the right border in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderrightcolor.asp">borderRightColor</a></td>
<td valign="top">Sets the color of the right border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderrightstyle.asp">borderRightStyle</a></td>
<td valign="top">Sets the style of the right border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderrightwidth.asp">borderRightWidth</a></td>
<td valign="top">Sets the width of the right border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderstyle.asp">borderStyle</a></td>
<td valign="top">Sets the style of all four borders (can have up to four
styles)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_bordertop.asp">borderTop</a></td>
<td valign="top">Sets all properties for the top border in one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_bordertopcolor.asp">borderTopColor</a></td>
<td valign="top">Sets the color of the top border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_bordertopstyle.asp">borderTopStyle</a></td>
<td valign="top">Sets the style of the top border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_bordertopwidth.asp">borderTopWidth</a></td>
<td valign="top">Sets the width of the top border</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_borderwidth.asp">borderWidth</a></td>
<td valign="top">Sets the width of all four borders (can have up to four
widths)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_margin.asp">margin</a></td>
<td valign="top">Sets the margins of an element (can have up to four values)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_marginbottom.asp">marginBottom</a></td>
<td valign="top">Sets the bottom margin of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_marginleft.asp">marginLeft</a></td>
<td valign="top">Sets the left margin of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_marginright.asp">marginRight</a></td>
<td valign="top">Sets the right margin of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_margintop.asp">marginTop</a></td>
<td valign="top">Sets the top margin of an element</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_outline.asp">outline</a></td>
<td valign="top">Sets all outline properties in one</td>
<td valign="top">5M</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_outlinecolor.asp">outlineColor</a></td>
<td valign="top">Sets the color of the outline around an element</td>
<td valign="top">5M</td>
<td valign="top">1</td>
<td valign="top">9</td>
<td valign="top">Yes</td>
</tr>
<tr>
<td valign="top"><a href="prop_style_outlinestyle.asp">outlineStyle</a></td>
<td valign="top">Sets the style of the outline around an element</td>
<td valign="top">5M</td>
<td valign="top">1</td>
<td valign="top">9</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -