Web Design

(Nancy Kaufman) #1

122


Specify Widths......................................................


2 Within the existing h1
declaration, type width: ?;,
replacing? with the desired
width of the element.


1 In your editor, open a
document that contains an
embedded style sheet and an
existing body declaration.


Specify Widths


B


y default, elements are as wide as the element that contains them. Elements directly within the
body of the document are as wide as the browser window. You can control this behavior using

the CSS width property. The width is calculated as only the width of the element’s content, so the


total size of the element is actually its width, plus the left and right padding values, plus the left


and right border widths. Keep this in mind when you are attempting to calculate the space needed


to place elements next to each other on the page.


1


2

Free download pdf