Blogroll

photoshop cs6 html 5 css php seo backlinks

adsense

Thursday, 6 February 2014

Learn CSS Box model - Height and width free tutorial

Up until now, we have not cared much about the dimensions of the elements we have worked with. In this lesson, we will take a look at how you easily can define the height and width of an element.
  • width
  • height

Setting the width [width]

With the width-property, you can define a certain width of an element.
The simple example below provides us with a box wherein text can be typed:
 
 div.box {
  width: 200px;
  border: 1px solid black;
  background: orange;
 }
 
 

Setting the height [height]

In the example above notice how the height of the box is set by the content of the box. You can affect the height of an element with the property height. As an example let us try to make the box in the example 500px high:
 
 div.box {
  height: 500px;
  width: 200px;
  border: 1px solid black;
  background: orange;
 }
 
 

0 comments:

Post a Comment