CSS1 Test Suite: 5.5.25 float


[Previous] [Next] [Section] [Contents] [Specification]

The style declarations which apply to the text below are:

P { margin: 0; padding: 0; text-align: justify;}
.one {float: left; width: 50%; background-color: yellow; padding: 0; margin: 0;}
.two {float: left; background-color: yellow; width: 100%;
      margin: 0; padding: 0; border-width: 0;}
.three {float: none;}
.four {float: left; font-size: 200%; font-weight: bold;
    width: 1.5em; background-color: silver;}
.five {float: right; width: 20em;
      background-color: yellow; border: 3px solid red;
      padding: 5px; margin: 10px;}
.six {float: right; width: 20em;
      background-color: yellow; border: none;
      padding: 5px; margin: 10px;}
.seven {float: right; width: 50%;
       background-color: yellow; border: 1px solid gray;}
.eight {float: left; width: 25%;
        background-color: #66CCFF;
        padding: 0; margin: 0}
.nine {float: right; width: 25%;
       background-color: yellow;
       padding: 0; margin: 0}


This paragraph is of class "one". It has a width of 50% and is floated to the left.

This paragraph should start on the right side of a yellow box which contains the previous paragraph. Since the text of this element is much longer than the text in the previous element, the text will wrap around the yellow box. There is no padding, border or margins on this and the previous element, so the text of the two elements should be very close to each other.



This paragraph is of class "two". Since the width has been set to 100%, it should automatically be as wide as its parent element allows it to be. Therefore, even though the element is floated, there is no room for other content on the sides and a orange square image should be seen AFTER the paragraph, not next to it. A yellow background has been added to this paragraph for diagnostic purposes.

[Image]

This paragraph is floated to the left and the orange square image should appear to the right of the paragraph. This paragraph has a yellow background and no padding, margin or border. The right edge of this yellow box should be horizontally aligned with the left edge of the yellow box undernearth.

[Image]

This paragraph is floated to the right (using a STYLE attribute) and the orange square image should appear to the left of the paragraph. This paragraph has a yellow background and no padding, margin or border. The left edge of this yellow box should be horizonally aligned with the right edge of the yellow box above.

[Image]

The first letter (a "T") of this paragraph should float left and be twice the font-size of the rest of the paragraph, as well as bold, with a content width of 1.5em and a background-color of silver. The top of the big letter "T" should be vertically aligned with the top of the first line of this paragraph. This is commonly known as "drop-cap".



This paragraph should be floated to the right, sort of like a 'sidebar' in a magazine article. Its width is 20em so the box should not be reformatted when the size of the viewport is changed (e.g. when the window is resized). The background color of the element is yellow, and there should be a 3px solid red border outside a 5px wide padding. Also, the element has a 10px wide margin around it where the blue background of the paragraph in the normal flow should shine through.

This paragraph is not floating. If there is enough room, the textual content of the paragraph should appear on the left side of the yellow "sidebar" on the right. The content of this element should flow around the floated element. However, the floated element may or may not be obscured by the blue background of this element, as the specification does not say which is drawn "on top." Even if the floated element is obscured, it still forces the content of this element to flow around it. If the floated element is not obscured, then the blue rectangle of this paragraph should extend 10px above and to the right of the sidebar's red border, due to the margin styles set for the floated element.



This paragraph is placed inside a DIV element which is floated to the right. The width of the DIV element is 20em. The background is yellow and there is a 5px padding, a 10px margin and no border. Since it is floated, the yellow box should be rendered on top of the background and borders of adjacent non-floated elements. To the left of this yellow box there should be a short paragraph with a blue background and a red border. The yellow box should be rendered on top of the bottom red border. I.e., the bottom red border will appear broken where it's overlaid by the yellow rectangle.

See description in the box on the right side



This paragraph is inside a DIV which is floated left. Its background is blue and the width is 25%.

This paragraph is inside a DIV which is floated right. Its background is yellow and the width is 25%.

This paragraph should appear between a blue box (on the left) and a yellow box (on the right).



See description in the box on the left side.

This paragraph is inside a DIV which is floated left. The background of the DIV element is blue and its width is 75%. This text should all be inside the blue rectangle. The blue DIV element has another DIV element as a child. It has a yellow background color and is floated to the right. Since it is a child of the blue DIV, the yellow DIV should appear inside the blue rectangle. Due to it being floated to the right and having a 10px right margin, the yellow rectange should have a 10px blue stripe on its right side.



TABLE Testing Section
 

This paragraph is of class "one". It has a width of 50% and is floated to the left.

This paragraph should start on the right side of a yellow box which contains the previous paragraph. Since the text of this element is much longer than the text in the previous element, the text will wrap around the yellow box. There is no padding, border or margins on this and the previous element, so the text of the two elements should be very close to each other.



This paragraph is of class "two". Since the width has been set to 100%, it should automatically be as wide as its parent element allows it to be. Therefore, even though the element is floated, there is no room for other content on the sides and a orange square image should be seen AFTER the paragraph, not next to it. A yellow background has been added to this paragraph for diagnostic purposes.

[Image]

This paragraph is floated to the left and the orange square image should appear to the right of the paragraph. This paragraph has a yellow background and no padding, margin or border. The right edge of this yellow box should be horizontally aligned with the left edge of the yellow box undernearth.

[Image]

This paragraph is floated to the right (using a STYLE attribute) and the orange square image should appear to the left of the paragraph. This paragraph has a yellow background and no padding, margin or border. The left edge of this yellow box should be horizonally aligned with the right edge of the yellow box above.

[Image]

The first letter (a "T") of this paragraph should float left and be twice the font-size of the rest of the paragraph, as well as bold, with a content width of 1.5em and a background-color of silver. The top of the big letter "T" should be vertically aligned with the top of the first line of this paragraph. This is commonly known as "drop-cap".



This paragraph should be floated to the right, sort of like a 'sidebar' in a magazine article. Its width is 20em so the box should not be reformatted when the size of the viewport is changed (e.g. when the window is resized). The background color of the element is yellow, and there should be a 3px solid red border outside a 5px wide padding. Also, the element has a 10px wide margin around it where the blue background of the paragraph in the normal flow should shine through.

This paragraph is not floating. If there is enough room, the textual content of the paragraph should appear on the left side of the yellow "sidebar" on the right. The content of this element should flow around the floated element. However, the floated element may or may not be obscured by the blue background of this element, as the specification does not say which is drawn "on top." Even if the floated element is obscured, it still forces the content of this element to flow around it. If the floated element is not obscured, then the blue rectangle of this paragraph should extend 10px above and to the right of the sidebar's red border, due to the margin styles set for the floated element.



This paragraph is placed inside a DIV element which is floated to the right. The width of the DIV element is 20em. The background is yellow and there is a 5px padding, a 10px margin and no border. Since it is floated, the yellow box should be rendered on top of the background and borders of adjacent non-floated elements. To the left of this yellow box there should be a short paragraph with a blue background and a red border. The yellow box should be rendered on top of the bottom red border. I.e., the bottom red border will appear broken where it's overlaid by the yellow rectangle.

See description in the box on the right side



This paragraph is inside a DIV which is floated left. Its background is blue and the width is 25%.

This paragraph is inside a DIV which is floated right. Its background is yellow and the width is 25%.

This paragraph should appear between a blue box (on the left) and a yellow box (on the right).



See description in the box on the left side.

This paragraph is inside a DIV which is floated left. The background of the DIV element is blue and its width is 75%. This text should all be inside the blue rectangle. The blue DIV element has another DIV element as a child. It has a yellow background color and is floated to the right. Since it is a child of the blue DIV, the yellow DIV should appear inside the blue rectangle. Due to it being floated to the right and having a 10px right margin, the yellow rectange should have a 10px blue stripe on its right side.




[Previous] [Next] [Section] [Contents] [Specification]