HOME
          About US
          Contact Us

Margin in CSS

Chapter - 20 : Borders and Dimensions (Margin in CSS): (Page 4/6)


(Cotinued from previous page)

ii) Variable Dimensions: The element dimensions can be defined by the min (minimum) and / or max (maximum) px. Any combination of these commands can be used.
min-height: 10px; min-width: 5px;

Here min dimensions will be marked for the element and the same will keep on increasing depending up on the size of element. This size will get restricted either by the max-height / max-width command or the properties of other elements defined in the page.
max-height: 200px; max-width: 250px;

Note: If the content is more than the size of the element defined in dimension, then the browser automatically makes a scroll bar for the visitor to scroll the content in the same area.



20.4- Margin: The margins are completely transparent area around an element (outside the border). This is used to make some gap between various elements.
Just like borders the margins can also be defined in different ways.

i) Auto : in this case the margin is automatically sets by browser and other elements available.
margin:auto;

ii) % : in this case the margin is a % of the containing element. Therefore if the size of element increases the margin will also increase.
margin:5%;

iii) Margin Commands: The Margins can also be defined in various ways. (as explained in border chapter)

a) In single line :
margin:10px; in this case the margin is 10px for all 4 sides

(Cont......... to next page (Pg-5))

Margin in CSS
© funandhobby.com (Margin in CSS)