CSS left attribute
Examples
The left edge of the image containing element disposed at a position 5 pixels left edge to right:
img
{
position:absolute;
left:5px;
}
{
position:absolute;
left:5px;
}
Attribute definitions and instructions
left attribute specifies the left edge of the element. This attribute defines the targeting elements comprising its border left margin offset between the left edge of the block.
If the value is "static" "position" property, then set the "left" property has no effect.
Note: If "position: static", the left property has no effect.
Defaults: | auto |
---|---|
inherit: | no |
version: | CSS2 |
JavaScript syntax: | object .style.left = "50px" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
left | 1.0 | 5.5 | 1.0 | 1.0 | 5.0 |
Property Value
value | description |
---|---|
auto | Defaults. Calculate the left edge of the browser location. |
% | Set as a percentage of the containing element meter left position. You can use a negative value. |
length | Use px, cm, and other units set to the left position of the element. You can use a negative value. |
inherit | Provisions should inherit the property value left from the parent element. |
related articles
CSS tutorial: CSS Positioning