HTML and CSS Reference
In-Depth Information
he align attribute when used in block elements speciies whether the text
of the element should be aligned with the let or right margin, or centered
within the containing element. his is similar to how the CSS text-align
property is used. However, when the align attribute is used in an image (img)
or table (table) element with a value of left or right , it acts like the CSS loat
property. It causes the content following the image or table to wrap around the
element on the right or let, respectively.
Sometimes, it is necessary to stop wrapping content around a loated ele-
ment before all of the available space is used. he clear attribute does this.
he valid values for the clear attribute are left , right , and both . Adding this
attribute to an HTML element causes the browser to add enough vertical white
space before rendering the element to clear it from any loating element. It
aligns normally with the let or right margin of the containing element. he
clear attribute works the same way as the clear CSS property. he following
two statements have the same efect:
<h3 clear="left"> A heading for this section </h3>
<h3 style="clear:left"> A heading for this section </h3>
he second level-three heading is the preferred usage because CSS is more
lexible. For example, if a page had many such level-three heading elements,
instead of adding the clear attribute to each, the web author could just add a
class attribute to accomplish the same thing using CSS. An example would be
<h3 class="clearloat">...</h3> . he CSS statement to clear all h3 elements in
the clearloat class would go in a style element in the document head, along
with any other styling needed for the headings:
<style type="text/css">
h3.clearfloat {
clear: left;
margin-top: 1.5em; /* provide extra space before each heading
*/
}
</style>
HTML block elements can have width and height attributes. If the value of
one of these attributes is a positive integer, it speciies the element's width or
height in pixels. A number followed by the percent sign (%) speciies a width
 
Search WWH ::




Custom Search