Favorites » His css pages

-
Back to Basics: A Beginners guide to starting a CSS Document
-
Apr 28, 2:14am
1 review
css
http://www.cssjuice.com/back-to-basics-a-beginners-guide-to-starting-a-css-do...
-
From the page: "Back to Basics: A Beginners guide to starting a CSS Document
Hereâ€s a tip for you. Never let the browser to decide what your site will look like. What weâ€ll go over today is a quick and easy way of defining styles for common html tags that should dramatically cut down on the amount of guess work a browser will have to do to interpret your website. As you all know some of our more popular browsers **cough** IE **cough** tend not to display things as well as we want on their own.
The good news is that itâ€s really simple to fix. The bad news is that itâ€ll take a little bit of typing to get it down to the way you want. I hope youâ€ve warmed your fingers up a bit so that you donâ€t get a cramp. Letâ€s get started…
Now, I like to start with the tag when Iâ€m creating my style sheet. It really doesnâ€t matter what order you go in, but I generally go down the list of whatâ€s first presented on the page.
body {
}
First up letâ€s define the margins and the padding of the body so that weâ€ll get a nice even border across all browsers.
body {
margin: 0px;
padding: 0px;
}
What the above does is tell the browser to make all margins and all padding zero pixels across the entire body (meaning our website can go full screen all the way out to the edges).
Next weâ€ll go ahead and define our fonts and background color that we want the browser to use.
body {
margin: 0px;
padding: 0px;
background-color: #FFFFFF;
font: normal 0.92em Arial, Helvetica, sans-serif;
}
With the font, Iâ€ve used a little bit of short hand just to keep things compact and simple. If you arenâ€t familiar with this, itâ€s perfectly ok to do whatâ€s comfortable for you.
With that out of the way, letâ€s move on to our next set of tags. For me this is either a tag with tags within it or a , depending on what type of site Iâ€m doing. Now is a good time to go ahead and define what we need for these two.
td {
font: normal 0.92em Arial, Helvectica, sans-serif;
}
div {
margin: 0px;
padding: 0px;
font: normal 0.92em Arial, Helvectica, sans-serif;
}
Youâ€ll notice that Iâ€ve zeroed out the margin and padding on all tags. Why would I do this? Simple, not all browsers use the same settings to display these. Doing this we bend the browsers to our will. I prefer zero when doing all CSS layouts, but you can set them to whatever works best for you.
Next on the list will be our handy dandy links, but before we jump into these Iâ€d like to say a few things. Links are a little different animal when it comes to redefining them. You could just make a standard â€oea” class in your CSS, but that doesnâ€t cover all aspects of the link itself. Instead weâ€ll use whatâ€s called â€oepseudo-classes” for our linking.
a:link {
color: #0000CC;
text-decoration: underline;
}
a:hover {
color: #0000CC;
text-decoration: none;
}
a:visited {
color: #551A8B;
}
What this basically means is that weâ€ll be able to control various states of a link like itâ€s normal state (a:link), itâ€s mouse over effect (a:hover), and itâ€s state after itâ€s been clicked (a:visited). I set all my links to default blue with an underline. Then when you put your mouse over them they stay blue, but the underline disappears. Once itâ€s been clicked, just so you know youâ€ve clicked it before, I chose to use a dark purple. Like always you are free to use whatever effects/colors youâ€d like. This is just to give you a starting block to build upon.
Now weâ€ll move onto the next tag weâ€ll redefine, to make appear standard across all the browsers, the *lt;p> paragraph tag. For some reason there is a huge difference in the margins created by the in FireFox and Internet Explorer. Weâ€re going to fix that.
p {
margin: 10px 0px;
}
Finally weâ€ll move out to our head tags . The â€oex” would be replaced by a number to suit your needs of course. These arenâ€t really used as often as they used to e, but they still hold some value SEO wise. So, just to be sure, weâ€ll go ahead and include how we want them to look instead of the greatly oversized bold black text they normally default to.
h1, h2, h3 {
margin: 0px;
padding: 0px;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.3em;
}
h3 {
font-size: 1.1em;
}
For the sake of time, and a lot of reading weâ€ll end it here. What you should end up with is a very basic CSS document that addresses a few issues that you may encounter when browser checking your new website.
body {
margin: 0px;
padding: 0px;
background-color: #FFFFFF;
font: normal 0.92em Arial, Helvetica, sans-serif;
}
td {
font: normal 0.92em Arial, Helvectica, sans-serif;
}
div {
margin: 0px;
padding: 0px;
font: normal 0.92em Arial, Helvectica, sans-serif;
}
a:link {
color: #0000CC;
text-decoration: underline;
}
a:hover {
color: #0000CC;
text-decoration: none;

-
Tabs con efecto acordeĂłn & Xyberneticos
-
Sep 11, 2007 5:55am
0 review
css
http://www.xyberneticos.com/index.php/2007/09/05/tabs-con-efecto-acordeon/
 See more popular pages about css liked by other StumbleUpon users.
|