float inline with block inline padding : Inline Elements « Style Basics « HTML / CSS






float inline with block inline padding

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <html>
        <head>
            <title></title>
            <style type='text/css'>
                div {
                    margin: 10px;
                    background:red;
                    height: 100px;
                }
                span#floated {
                    background: pink;
                    margin: 10px;
                    padding: 10px;
                    border: 1px solid black;
                    float: left;
                    width: 100px;
                }
                span#normal {
                    background: gold;
                    border: 1px solid black;
                    margin: 100px;
                    width: 1000px;
                    padding: 50px;
                }
            </style>
        </head>
        <body>
            <div>
                <span id='floated'>
                    This span is floated left.
                </span>
                <span id='normal'>
                    The text of this span is beside the floated span.
                </span>
                This is extra text. This is extra text. This is extra text. 
                This is extra text. This is extra text. This is extra text.
                This is extra text. This is extra text. This is extra text.
                This is extra text. This is extra text. This is extra text.
                This is extra text. This is extra text. This is extra text.
                This is extra text. This is extra text. This is extra text.
            </div>
        </body>
    </html>

 








Related examples in the same category

1.CSS provides the following properties for styling inline boxes:
2.Inline Elements list
3.Inline Box
4.Shrinkwrapped inline block by setting both width and height to auto
5.On an inline-block element, a positive value in margin-top expands the height of the line and a negative value shrinks it.
6.Block-level elements
7.inline element is floated
8.float inline block becomes block of multiline inline box
9.float inline elements becomes block
10.Middle Offset INLINE
11.Shrinkwrapped Absolute right aligned
12.Stretched Absolute in relative positioned parent
13.Middle Aligned INLINE