Showing posts with label #Padding. Show all posts
Showing posts with label #Padding. Show all posts

Chapter 7 - What is Division in CSS?

The word "Division" derived from the word "Parts". This means that you can make as many parts as you want to show different elements on your website with the help of style sheet.

You can use almost every bit of your website page's space.

In my previous chapters, you have learnt about the syntax or properties of css.

Now it is time to learn about how to use in HTML coding. It starts with DIV tag in HTML and you can reserve space of a website page with as many DIV tag as you want with the help of style sheet.


To create above layout; use the coding as shown below:-


Example of CSS CODING


 /* Here I am using for CSS IDs to create Main Screen, Left, Center and Right Division*/

 #main
 {
    width:425px;
    height:261px;
    background-color:blue;

    border:20px solid brown;
 }
 #left
 {
    height:116px;
    width:130px;
    background-color:#FFFFFF;
    border:2px solid red;
    border-radius:20px 20px 0px 0px;  
    float:left;
    border-bottom:50px solid red;
 }
 #right
 {
    height:116px;
    width:130px;
    background-color:#FFFFFF;
    border:2px solid green;
    border-radius:20px 20px 0px 0px;  
    float:right;
    border-bottom:50px solid green;
 }
 #center
 {
    height:116px;
    width:130px;
    background-color:#FFFFFF;
    border:2px solid pink;
    border-radius:20px 20px 0px 0px;
    margin-left:10px;  
    float:left;
    border-bottom:50px solid pink;
 }

Now have a look on the HTML coding to make divisions.

Example of CSS CODING


 /* Here I am using DIV Tag of HTML to make Divisions on the page*/

 <div id="main">
   <div id="left"></div>
   <div id="center"></div>
   <div id="right"></div>
 </div>

Now I hope everything is clear to you with respect to Division in CSS.

For more examples on CSS based layout and the use of all CSS attributes and properties; see blog posts.

And share your feed back.

Chapter 6 - What is Padding in CSS?

What is padding and How to set padding in CSS?

CSS Padding is an internal space around the content in the element.

Properties of Padding is quite same as Margin. Syntax is also same.

Padding is of 4 sides/types and it is a Clock wise direction while writing in coding:-
  1. Padding-Top
  2. Padding-Right
  3. Padding-Bottom
  4. Padding-Left
By default all sides have padding existed but with your CSS coding you can either remove or extend padding of 4 the sides.

The Padding property can be set for the top, right, bottom and left of an element. (See below example)


 Syntax of 4 sided padding:-

 padding-top:Value;
 padding-right:Value;
 padding-bottom:Value;
 padding-left:Value;

/*NOTE:- Padding value could be in Pixel, Percentage or em.*/ 

You can also declare a padding value in a single row as it is shown in below example:-

 For setting all 4 sided padding, use TRBL  format. Example:-

    padding:T R B L; (Top, Right, Bottom, Left)
 padding: 10px 20px 30px 40px;


/*NOTE:- Padding value should be read clock wise.*/ 

 If values of all sided padding is same then use the following syntax:-

    padding:10px; /*4 sides padding*/
 padding:-10px;/*negative padding of 4 sides*/

/*This will set 10px, -10px padding for all 4 sides*/
 
 padding:10px 20px; /*top, right padding*/

/*This will set 2 sided padding*/
 
 padding:10px 20px 30px; /*top,right, bottom*/


/*This will set 3 sided padding*/

You can read 4 sided padding as TRBL (this term is first ever used by CSSBASICTIPS.