Page 41 - modular_v2.0_HTML&_CSS_Fb
P. 41

MARGIN PROPERTIES

                 Margin is the space that appears around an element. The margin property is used to set margins
                 for any web page element. The four sides used with the margin property are: left, right, top
                 and bottom. The value of sides can be measured in pixels (for example: 20px, 30px, etc.) or as a
                 percentage of the window. Properties to set margin around an element are:

                      MARGIN: It specifies the margin around an element on all sides.
                      MARGIN-BOTTOM: It is used to set the bottom margin of an element.
                      MARGIN-TOP: It is used to set the top margin of an element.
                      MARGIN-LEFT: It is used to set the left margin of an element.

                      MARGIN-RIGHT: It is used to set the right margin of an element.

                      Syntax:  MARGIN:VALUE;
                      OR

                      MARGIN-TOP:VALUE;
                      OR
                      MARGIN-BOTTOM:VALUE;

                      OR
                      MARGIN-RIGHT:VALUE;

                      OR
                      MARGIN-LEFT:VALUE;
                 Let us create a web page to use margins.

                 <!DOCTYPE HTML>
                 <HTML>
                 <HEAD>

                 <TITLE>CSS Margins</TITLE>
                 </HEAD>
                 <BODY>
                 <H1> CSS Margins</H1>

                 <P STYLE="MARGIN-TOP:200PX;
                        MARGIN-BOTTOM:100PX;
                        MARGIN-RIGHT:200PX;
                        MARGIN-LEFT:120PX;">

                 In CSS, margins define the space around an element, outside of its border.
                 Margins create distance between the element and other surrounding elements.
                 You can use them to control the layout and positioning of elements on a
                 webpage.
                 </P>




                                                                                                                39
                                                                                        Cascading Style Sheets
   36   37   38   39   40   41   42   43   44   45   46