width property
Specifies the width of the visible area for an element.
This property has effect only on block-level elements or on elements with absolute or fixed position.
The overflowing content can be manipulated by the overflow property.
The width property contains only the width of the visible contents with the vertical scrollbar, but without the padding, border and the margin.
- Use the height property to set the height of the visible area for an element.
- You can specify a range for the size of an element with the min-width, min-height, max-width and max-height properties.
- Use the left, top, right and bottom properties to specify the position for an 'absolute', 'fixed', or 'relative' positioned element.
JavaScript page for this property: width. You can find other example(s) there. |
Possible values:
One of the following values:
Default. The width of the object is determined by the values of other properties. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
The width of the element in length units. For the supported length units, see the length page. | |||||||
The width of the element is the specified percentage of the width of parent element. |
Default: auto.
Example HTML code 1:
This example illustrates the use of the width property:
|
||||
<head> <style> .example { background-color: #E9E9E9; width: 300px; height: 200px; } </style> </head> <body> <div class="example"></div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, H1, H2, H3, H4, H5, H6, hr, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, object, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments