[CSS]CSS Codes

TehByte

Active Members
Okay, so firstly to code CSS we need to open up the CSS tags

Code:
<style type="text/css">

</style>
In between the tags we can now start styling our web pages

Firstly, to style a certain part of the website you need it's ID or Name. If we are editing for example a div that uses ID="Main" we would have to write the code like this

Code:
#Main {

}
But if we are using the name="Main" tag we would write the code like this

Code:
.Main {

}
To style anything else like the body of the page you would write the code like this

Code:
body {

}
Our styling codes then go in between the { and }.

So I will now write a list of different definitions

Styling fonts

Code:
font-family: FONTNAME;
font-size: 12px;
color: HEX/COLOURNAME;
font-weight: bold/none;
text-decoration: underline/none;
Adding a border

Code:
border: 1px solid #000000;
Backgrounds

Code:
background-color: HEX/COLOURNAME;
Links

Code:
a:link { }
a:visited { }
a:active { }
a:hover { }
I shall add more as they come to my mind, if you know any more please reply and I shall add. Sorry for the bad grammar, I'm tired, I'll correct when I wake up if I have time...

 

Josh

Active Members
If any of you are wondering, you may think why:

Code:
text-decoration: none;
is needed for example. In reality it isn't needed and some would see it as a waste of space/bytes - however some people add it in just as a habit or to be sure that it's normal text.

 
Top Bottom