CSS

adplus-dvertising
CSS style sheet code for making page margin
Previous Home Next

CSS code for this is given below-

body {
margin-left: 15%; margin-right: 15%;
}

As you can see, you can redefine any tag and change the way it looks! This can be very powerful.

div {
background: rgb(204,204,255);
padding: 0.5em;
border: 1px solid #000000;
}

The above CSS code sets that any <div></div> tag will now have a background color of ‘rgb(204,204,255)’ and have a padding of 0.5em and a thin 1 pixel border that is solid black. A few things to explain about the above- Color in CSS can be expressed in a few ways:

  • In Hex -> for example: #000000 – this is black and this: #FF0000 is red.
  • In rgb -> rgb(204,204,255) is a light purple blue color.
  • With named colors like: ‘red’ or ‘blue’

In the following example I will show you the ‘Most Importantl’ CSS code that allows you to create link roll-over affects without images:

a:link { color: rgb(0, 0, 153) }
a:visited { color: rgb(153, 0, 153) }
a:hover { color: rgb(0, 96, 255) }
a:active { color: rgb(255, 0, 102) }

The above CSS will cause your links to change color when someone hovers their mouse pointer over it, instant rollovers with no images! One important note with the above code, is that it is important that the style declarations be in the right order."link-visited-hover-active”,otherwise it may break in some browsers.

Previous Home Next