Filed under CSS, HTML, Tutor

Beginner’s guide to CSS

Previous page

Full HTML template and sample CSS

Let’s start by putting the two pieces of HTML I showed you together and combine it with some sample CSS: Sample HTML + CSS. You can find all code that makes that page below. Feel free to copy the code below and experiment on your own.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Your own page title</title>
   <link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>

<div id="header">
   <h1>The name of this page</h1>
</div>
<div id="navigation">
   <h2>Navigation</h2>
   <ul>
      <li><a href="first.html">First</a></li>
      <li><a href="second.html">Second</a></li>
      <li><a href="third.html">Third</a></li>
   </ul>
</div>
<div id="content">
   <h2>Content</h2>
   <p>Some sample content, add your own here</p>
</div>
<div id="footer">
   <p>This page is written by [Your name] and builds on a <a href="http://friendlybit.com">Friendlybit template</a>.</p>
</div>

</body>
</html>

You should be able to tell what each part of the HTML does by now. Let’s instead have a look at some sample CSS for the structure we have above. If you want to experiment with this code you can copy it to a file named style.css (or any other filename you reference in the <link>-tag in the HTML) and place it in the same directory as the HTML document.

body {
	background-color: Green;
}
div {
	border: 3px solid Black;
	padding: 7px;
	width: 600px;
}
h1, h2, h3, h4, h5, h6 {
	margin: 0;
}

#navigation {
	float: left;
	width: 150px;
}
#content {
	float: left;
	width: 430px;
}
#footer {
	clear: both;
}

Let’s go through the six rules above. First we set the background-color of body, and body is the background of everything, so this will do the same as bgcolor did in HTML.

Next we set some styles on all divisions on the page. We have four of them and with this single rule we affect them all. First we set a black border to be 3 pixels wide (note that there is no space between number and unit in CSS). We then set a padding (the space between the border and content) to be 7 pixels and lastly we set the width of all divs to 600 pixels (note that margins, borders and padding are not included in the width).

The third rule selects all headers on the page and removes the margins (the space between the border and other nearby elements) from them. The commas are used between the elements to apply the same CSS to all of them.

Next we have some specific rules for three of the divisions. We position the navigation to the left of the content. This is done by using floats, a way to put things side by side. If you have used the align-attribute on images in HTML you will know how floats work, they move the element as far to the left as possible and then let the next element follow right next to it. If you want to put something below a float you need to clear it. Clearing moves the element down until it’s below any floats, exactly where we want the footer. So both navigation and content are floated and given a width to match the 600 pixels wide header, and the footer is cleared.

[Update: I have added some simple layouts for you to look at. Hope they help all of you out there that learn by examples.]

Now it’s your turn, you will learn CSS by using it and trying out how things work. So go ahead and play with the sample above. There are always people available to help you if you get stuck in the #CSS channel on EFNet. Thanks for reading, and good luck!

Any ideas of how this guide could be improved? Just leave a comment to the left.

Pages: 1 2 3 4

Feel free to leave a comment, or subscribe to my feed.

related

List some related articles:

You might want to browse all articles.

linkback

These people have linked to this article:

To get a link in this list: make sure your blogging software supports trackbacks or pingbacks and simply link to this article like this:

<a href="http://friendlybit.com/css/beginners-guide-to-css-and-standards/">Beginner’s guide to CSS</a>

You can also trackback by copying this link, and pasting it into a trackback field in your blogging tool.

about

Author: Emil Stenström

Emil Stenström blogs about web development. Posts are bi-weekly.

To the about section

comments

What do you think about this article? I’d love to hear your view!

Scroll to comment box.

  1. Jim Berger 23 Jan

    01

    Thanks.

  2. Michael Gernes 24 Jan

    02

    Emil,

    Thanks so much for providing such a friendly tutorial for those of us still learning CSS!

    I’m a technical writer by trade, and I really appreciate the tone and organization of your writing. It’s helped me to understand CSS a little better in the time I’ve taken to read it.

  3. bikhod 24 Jan

    03

    Hi

    Excellent and informative introduction. I particularly like the template page that you provided.

    I think a mention of http://www.csszengarden.com would be good too.

  4. arnab 24 Jan

    04

    This is a great article for a beginner of HTML.If you could write more CSS properties and where can we find such a list of them then we can get a direction towards the next level in CSS designing.

  5. leela kolluri 24 Jan

    05

    Hey,
    This is the best website I’ve ever seen on the introductory course for style sheets and html. It is very useful and simple and effiecient. I just liked it so much.
    regards,
    Leela

  6. Shan 26 Jan

    06

    A very nice tutorial. Thanks.

  7. Bill 27 Jan

    07

    I put content into a div that is down the page from the header but put the code just after the body start to help the search engines get to it easier. As I work in CSS, is this still feasible?

  8. Emil Stenström 27 Jan

    08

    @Bill: Sorry, but I don’t understand what you mean. Please ask support questions in the IRC channel #CSS on EFNet, not in comments.

  9. Ron Kolegraff 28 Jan

    09

    Thanks,
    right help at the right time.
    I was on the verge of going back to tables frustrated with the explainations I found for CSS.
    This tutorial saved my site from that. I anticipate this summer being able to convert my site from badly coded tables to style separated from content pages.
    RJK

  10. Emil Stenström 28 Jan

    10

    @Ron: Good to hear! Don’t give up and go back to tables, it’s not worth it I promise.

  11. Tobias 31 Jan

    11

    It’s all good… but there are still things that you can’t do with CSS but can with tables… it works the otherway aroud to, some times the best way is to combine the two.

  12. Shyam 31 Jan

    12

    hi sir,

    this is good to learn CSS., i m a student from Sweden,

    thanking you,

  13. draco 31 Jan

    13

    Nice writeup regarding CSS and HTML. I’m really glad to find that you’re using HTML 4.01 (Strict) instead of XHTML 1.0, and that’s good.

    Actually I think a site is made up of 3 parts: content, presentation, and behavior. I could be wrong, just what I thought!

    Just curious, does all other browsers (except MSIE) have quirks mode rendering? (Besides the fact that they’re all great tag soup parsers.)

    And while I was scanning through, I was wondering why you suggested against the use of b and yet demonstrated the right usage of em instead. How about strong? With that we can really do away with font-weight: bold;! Well, at least to me it doesn’t matter if strong is a level more emphasis’d than em. Just some thoughts about this. I’m sure you have your reasons to do so. :)

    I’m not doubting you, and this is an article I’m sure alot newcomers can learn from. This comment is just me some 2 cents. Hope I’m not being too offensive.

    Good job.

  14. Emil Stenström 2 Feb

    14

    @draco: A site is made up of as many parts as you want it to be, I could easiliy tell you 10 parts if you wanted. For this beginners guide 2 is enough.

    All modern browsers have quirks mode/standards mode rendering, some even have a “almost standard” mode.

    I used em because that’s what I think most people mean when they use the b element. Strong is another level of emphasis, something that I don’t think makes it as good to start out with.

    Thanks for you comments! :)

  15. Martin 5 Feb

    15

    Hi!
    How to position divs using CSS position:relative? When I try to position elements in this way it behaves like position:absolute.
    For example:
    #something
    {
    position:relative;
    top:50px;
    left:50px;
    }
    this should position the element with id=something 50 pixels down and left from the previous element, yet in my case it behaves like absolute and places the element 50px down and left from the starting coordinates of a document. :(

  16. Emil Stenström 5 Feb

    16

    @Martin: you are better off just setting margin-top: 50px; and margin-right: 50px; on #something if you just want to move it down.

  17. Arthur Allison 6 Feb

    17

    Thank you, it has been many years since I have needed to use html. I want to build a professional looking site for a new venture I am undertaking. I downloaded a few templates that I thought would make this easier. Of course I had never used CSS, I fell flat on my face. This tut will help, has helped a lot. I will create a link to your site for sure, it is in direct interest to my targeted users.

  18. Emil Stenström 6 Feb

    18

    @Arthur: Thanks!

  19. Chad 6 Feb

    19

    Emil, nice work. Others have already commented on the usefulness, so I will simply add that you did a fantastic job of zeroing in on some very basic yet powerful concepts. You explained them very well, and your writing style is very pleasant.

    Your article is helpful, informative, direct, and a joy to read. I look forward to reading more of your work in the future!

  20. Robert 10 Feb

    20

    Excellent article.

  21. Chris Charlton 14 Feb

    21

    Good short, beginners, article! :)

  22. Will 14 Feb

    22

    Hi Emil,

    Thanks for a great tutorial. This is the first tutorial I have read about CSS that is straightforward enough to understand.

  23. Penny Pett 15 Feb

    23

    The tutorial is excellent but would like a print option so I could print out all four pages at once with the text of the article. But thanks!

  24. Trebek 15 Feb

    24

    nice, very helpful.

  25. Andrea 16 Feb

    25

    Hello Emil,
    I’ve had a very little understanding to what CSS really is, even though I had a rough idea about what you can do with it. Then my Sister found a bunch of CSS sites while browsing and she shared the links with me. I clicked on yours first and I must say it is extremely helpful to my first attempts at getting a homepage based upon CSS done. Thanks a lot and keep up the good work!
    Cheers,
    Andrea (from Hungary)

  26. vandana 17 Feb

    26

    Your article is fantastic,could you help me out can we create round curve box through CSS class.If we can do it through this,it will be better for me.
    Kindly give me more suggestion if you have

    Thanks,
    vandanag

  27. Emil Stenström 17 Feb

    27

    @vandana: Yes, it is possible to add rounded corners by using an image together with CSS. I have an article about that planned, stay tuned.

  28. Susan 18 Feb

    28

    I am finally finishing up my college education (started in the fall of ‘65) all online, and one of my courses this semester requires us to submit three papers on topics of our choice, within limits of the course, but they must be formatted with HTML, and the paper due next week must also use CSS and Meta tags. My discovery of your article(s) couldn’t have come at a better time. And the info is simple enough that us older newbies can understand and use it.

    Many, many thanks.

  29. David Brooks 20 Feb

    29

    Add ons Add-ons addons
    Why not simply write a language that allows one to write pages? All these bits & pieces html, xhtml,(yhtml), php,java,css,uncle Tom Cobbly and all. They always said that a camel was a horse designed by a committee.

  30. name* 22 Feb

    30

    PLEASE do NOT use color alone to convey information, RE: the red stars, as color-blind people and screen readers do NOT know what color red is. Please convey the info in a more constructive way. THANKS

  31. Emil Stenström 22 Feb

    31

    name*: What stars are you talking about? I don’t use any stars on my page.

  32. name* 24 Feb

    32

    The red stars on this form. I can see, whilst hovering over the asterix (star) that you have used the title attr. BUT those people WITHOUT browsers aware of title attr. AND users who MAY be color-blind do NOT know what red is or that the title attr. says ‘Required’. It’s just a small point, and I know it MAY seem nitpicking BUT one of the basic rules is do NOT use color alone to convey information, etc. Perhaps you could use the label or span attr. as well, and put in brackets next to the asterix (star) that the field is required.

    Sorry if I came across as rude, wasn’t meant to be.

  33. Emil Stenström 24 Feb

    33

    name*: I don’t use color alone! Using an asterix is a well spread way to indicate that a field is required. As you say I could aviod using the word “red” but I don’t think that matters. The asterix itself conveys the same information.

    [change: I've changed the word star to asterix to make the text a little clearer]

  34. matt nixon 26 Feb

    34

    cool..been trying to learn this stuff on my own for a while now.I just learned more in 5 minutes,than i’ve learned in the past month…and i’m only on like the third page.I’m excited,thanks

  35. Carol Brannon-King 27 Feb

    35

    Thank you very much!
    I have read numerous books trying to grasp the basic concepts and understanding of CSS and it has been difficult.

    Your tutorial is Excellent!

    It makes so much sense and Easy to grasp. Also, thank you for the additional resource links!

  36. Kailash 2 Mar

    36

    Excellent Article.
    It has changed a lot the way i was Creating web pages.

  37. Regina 4 Mar

    37

    I greatly enjoyed reading your article. I’ve been searching for a clean-cut explanation of CSS, as I am building more sites and want to move into a more portable way to code them.
    Thanks!!

  38. Louise Buck 8 Mar

    38

    Your guide has confirmed where we were heading … to the re-design of our web pages about gardening. We’ve just removed 53 pages from the site and have been trying to figure out how to reconstruct for future posting. Thanks!

  39. Matt Knight 9 Mar

    39

    on your begginers guide to css you state… “do this by adding this line:”

    What line? i’m viewing this on a MAC and there is no line of code visible to add. I might be being a complete numpety but I can’t seem to find it. Thanks

  40. Norm 9 Mar

    40

    I am a java developer and always been a little wary of divs and css. That guide makes perfect sense and is concise. Excellent and thanks.

  41. Emil Stenström 9 Mar

    41

    @Matt Knight: there should be a green box below with a line of code. What browser are you using? I’m not supporting IE on Mac. I’m guessing that might be the problem.

  42. Jewel 11 Mar

    42

    Thanks for this excellent article. A few of my online friends have been asking me how to move from tables based layouts to designs built with css and standards, and being fairly new to css myself, it has been difficult to take them through it step by step. Now I shall just point them towards this article!

  43. Josef 12 Mar

    43

    Great article! I would like to suggest that you put a printable version of your articles for easy reading offline without having to save all the web pages.

  44. chica 13 Mar

    44

    like another commenter said, I’ve learnt more in this one tute than in all the rest I’ve been breaking my head over. Thanks for taking the time : )

  45. Jim 14 Mar

    45

    What is the deal with Netscape and I.E.? I can get everything looking great in I.E. but when I look at my hard work in Netscape the margins are all over the place! Netscape doesn’t seem to handle the FLOAT property well at all.

    Jim

  46. li.sang 15 Mar

    46

    thanks.

  47. Matt 15 Mar

    47

    Great tutorial, enjoyed reading and trying out new things. Noticed with your website though the background is different in IE to Firefox. In Firefox its looking great with the gradient contrast, but in IE you see 2 colour strips.

  48. Emil Stenström 16 Mar

    48

    @Matt: Thanks for pointing that out. I’ll take a look, IE has problems with some pngs it seems. What a mess that browser is.

  49. Anurag Soni 16 Mar

    49

    nice tutorial for begginer . keep it up.
    Thanks
    Anurag Soni

  50. Anurag Soni 16 Mar

    50

    excellent tutorial. it helps me a lot.
    Thanks
    Anurag soni

  51. Ksenya 16 Mar

    51

    This article is so cool! I’m just getting to know css and for me your examples are very handy!
    Thx!

  52. srinivas 18 Mar

    52

    hi sir
    iam new to html and css concepts but when i looked at ur site it was pretty interesting and i am able to learn a lot about css so keep up the good work for the sake of beginners

  53. gaoshou 25 Mar

    53

    As i don’t know that the article with this url http://bbs.w3pub.com/announce/announce.asp?BoardID=3&ID=1008 is copy from your website,I know this article by another website,because i don’t know where this article is from,i didn’t write the author of this article,i has add it.

  54. Emil Stenström 25 Mar

    54

    @gaoshou: thanks for removing that article from your site. No hard feelings.

  55. Kavita 28 Mar

    55

    This article is really of great help to the people who want to make a quick start with designing with CSS.

    The way it has been presented is fabulous.

    Keep up the good work

  56. zaharamh 29 Mar

    56

    Thanx for the article!I have been hating table-based html for a long time, and just recently started to discover the amazing css-world.Ur explanation helped me a lot!

  57. Chris 8 Apr

    57

    Emil, I am impressed! To take something that is as “complicated” as CSS and put it across so well, is very well done. (I say complicated because some tutorials make you feel you should have a degree to work with css)Your level of communication is perfect for the level of reader you are dealing with. Thank you and keep up the good work and look forward to reading more.
    kind regards
    Chris

  58. tek-69 22 Apr

    58

    Great guide. I found it very helpfull. It was simple to follow and explained everything very clearly.

  59. Hasib 23 Apr

    59

    Hi, your tutorial gives an excellent introduction to CSS. Thanks!

  60. James Thomas 24 Apr

    60

    What’s your take on CSS Layer tags? I find them very easy to work with in the Dreavweaver environment, but I am getting W3C validator errors us the yin/yang. I have heard that there may be some compatibily issues with different brousers, particularly Netscape.
    Anyway, thanx for the CSS tutorial. Now that I have read your four page tutorial, at least I have a basic understand how the CSS DIV tag works.

  61. Emil Stenström 24 Apr

    61

    @James Thomas: I must say I kinda dislike them. Dreamweaver is a good code editor but when it comes to “click and play” design it fails. Those layers you speak are not needed at all - CSS lets you position any element anywhere, just as if it was a div or anything else. Layers in Dreamweaver hides that and makes people think that layers are something special while they are just something the Dreamweaver folks made up. I would recommend coding by hand instead. Thanks for commenting!

  62. Jason Bates 25 Apr

    62

    Maybe i’ll join you in the #CSS chat some time.

  63. Mike T 25 Apr

    63

    Great Site. I saved your page locally and removed just the stylesheet link. The difference between the Before and After stylesheet application is startling. Good demonstration of the power of CSS

  64. rajesh 27 Apr

    64

    your tutorial gives an excellent introduction to me., it is very usefull to me

    thx,
    Rajesh.D

  65. alex b 28 Apr

    65

    This site rocks! Thanks so much for the easy to understand guide to CSS, made me understand what that was all about. Used it on my site and still do :)

  66. Peter D Wilson 30 Apr

    66

    Great site, great articles but get rid of the “So trust me”s They detract from your excellent writing.

    Peter

  67. Julius 2 May

    67

    great site, thanks for the tutorial :D

  68. Ali 3 May

    68

    Hi
    I want to know how can Find Downloadable CSS manual?

    Please tell me by email!

    Good Luke

  69. Emil Stenström 3 May

    69

    @Ali: I googled what you asked for and found this: http://www.htmlhelp.com/distribution/

  70. Torin 9 May

    70

    Very cool tutorial and a good fun reading. It is clear and simple and it shows that you care about the readers.
    I’m learning from your materials - thanks! Will tell others.

  71. Kyle 24 May

    71

    Wow, this was much better than the W3C tutorial. I kept falling asleep reading that and never really understood it.

    Thanks!!

  72. vj_ 25 May

    72

    Good job Emil, my translation of your tutorial into polish is in progress :-)

  73. mrv 1 Jun

    73

    nice articles im really a css enthusiast…this is a good article

  74. keules 4 Jun

    74

    ech tu prasipyseli :)

  75. Rich 5 Jun

    75

    The only thing I can think of to improve this guide is to add a “show example” link after each section of coding, so that people who are more visual in their learning, can see the progress as it goes along.

  76. Anil 12 Jun

    76

    I need more info about CSS if there any PDF Book on Net.

  77. sbt 13 Jun

    77

    nice to see an up to date beginner’s site. you could mention that page-authors are the least tolerant of befuddled beginner’s questions. One thing about using css (I first used css for a project last year), is that I get ideas for how I’d like something to work, and have to try some dead-end and experiments before I get good results - or before realize i cannot have the idea I’d conceived.

  78. Risto 13 Jun

    78

    Great pages You have compiled. Will definetly come back to learn more .
    Thanks!

  79. Quin 14 Jun

    79

    Hey, I am a newbie. There is a learning curve to html and css. But that’s OK. You can either spend a lot of money on shortcuts or simply learn how to code for free. Thanks for your erudite commentary and more than helpful website. To those visitors who require more, PLEASE, do not ask him for more than he’s already giving us…

  80. Jerry Scripps 14 Jun

    80

    Wonderful article. Thanks so much. I’ll have my students reference this next winter

  81. monika wulfers 15 Jun

    81

    I have tried to center my webpage in any given window, no luck, sorry I am still beginning. Tried a lot of css. No luck. Suggestions? Thanks

  82. Emil Stenström 15 Jun

    82

    To all of you, thanks for the great comments, it’s these that gives me the motivation to keep going on :)

    @Rich: Good suggestion! If I only had the time :/ I’ll see what I can do. That and a print version of all the pages is on my ToDo.

    @Anil: I havn’t read any CSS Books, all the info I know if from the net and trying stuff out myself. I’ve hear good things about Zeldman’s book though, you’ll find it with a google search.

    @Quin: Bahhh, let them ask what they want :) If I don’t like it I’ll give my motivation.

    @Jerry Scripps: Good to hear. Looking at my referers it seems it’s used as a getting started tutorial all over the world.

    @monika wulfers: First, make sure you’re in standards mode. Then just give your page a width and set it’s left and right margins to auto. #content { width: 760px; margin: 0 auto; }

  83. Sarmad al Saadi 16 Jun

    83

    Hi

    Your website is magnificient, but what I suggest to give more attention to the quality of tutorial of the CSS. The beginning was OK, but not the end. I wish you success in Sweden

    Sarmad

  84. Raj 17 Jun

    84

    A great tutorial. Helps me a lot.

  85. Ranjith kumar 20 Jun

    85

    This is a phenomenal. I have cleared almost all the doubts i had in my mind about css. Coooooool !!!

  86. Emil Stenström 20 Jun

    86

    @Ranjith kumar: Cool you like it, show it to your friends :)

  87. Simone 23 Jun

    87

    Would be nicer is you have a “printer friendly” link/button so that we can print it out and read it….

  88. Lewis Meyer 24 Jun

    88

    copied most of it to Word, now going back to read it. A printable version would be nice. I’ll let you know what I think, when I get done. :-)

  89. Emil Stenström 25 Jun

    89

    @Simone, Lewis Meyer: It’s on my ToDo, just not on top :)

  90. ashok.kakani 5 Jul

    90

    Hello, this book is very helpful us,this is very simply and also very useful.
    Regards
    kakani.ashokchoudary

  91. Ilya Surdin 5 Jul

    91

    Thank you very much!
    Exactly what I’ve been looking for. Tables got on my nerves a lot. :)

  92. Ilya Surdin 5 Jul

    92

    Ah, yes, 2 small things I forgot to add. :)
    1) Got here from w3.org. WTG :)
    2) For anyone having trouble doing things with css described here, just look at the css-es of this page ;)

  93. Emil Stenström 5 Jul

    93

    @Ilya Surdin: I’m not sure this site’s CSS is such a good place to learn, I use a lot of little tricks that would take me hours to explain…

  94. latha 26 Jul

    94

    A good and simple site for learning css

  95. aji 28 Jul

    95

    very usefull tutorial for beginners..

  96. Fahad 29 Jul

    96

    It’s a very good site.
    Thanks so much..

  97. Nebojsa 9 Aug

    97

    Thanx man… Hugs from Serbia!

  98. Mchl 12 Aug

    98

    I think I’ve just gained a CSS knowledge level… Now I’ve got to find some time to rebuild my city and trest all this stuff…
    Many thanks for this tutorial. Made me look at HTML+CSS combo in a diffirent way.

  99. Peter Nathaniel 27 Aug

    99

    im really sorry but i dont really understand what you mean… how do you put the images? i dont get it… sorry…

  100. Emil Stenström 27 Aug

    100

    @Peter: what images? I don’t use any images in that example.

  101. MJ 1 Sep

    101

    Hi!
    Wow,the moment i read this, i undertstood it. I have visited and read their a few tutorial sites but this site is great. And i also like the idea that you highlight the important words. It is like im reading a book then marking the important ideas. Thanks a lot and more power! :)

  102. chai 2 Sep

    102

    thanks a lot for the tutorial, i found it really helpful compared to some other tutorials i have been trying to study. i do have one suggestion, it would be nice to have more examples to experiment with, if you could set up a little quiz at the end of the tutorial, that would be nice
    :)

    thakns a lot, chai

  103. Decio 7 Sep

    103

    Dude, this is pretty good tutorial, its a really good starter tutorial. I thinks it explains well the chracterisrics of CSS.
    Cheers

  104. brianb 5 Oct

    104

    Thanks, for the tutorial…
    You’ve provided me with a clear understanding of CSS..I enjoyed the idea of “separation of content and design” two part of website.
    My life has new meaning : )
    Have a great Day

  105. Brad 22 Oct

    105

    Well, OK. I’m old (67) and have perhaps a different feeling about how to describe something. It looks to me like CSS is an add-on to web formatting tools, something that enhances HTML. CSS has a syntax, HTML has a syntax, and they’re not the same syntax. I have no problem with that (it makes sense that theyd be different), but what I’d like to see is at least a brief mention of itsyntax and syntax elements. For instance, it’s unclear to me which syntax elements of HTML work within a .css file. If I want to specify an image for the header in the CSS file is it exactly the same as the HTML syntax or is it different?

    I’m sure that, as I keep looking, I’ll find the answer, but seeing a statement about what HTML syntax is vlaid within a .css file and what is not would (I think) improve understanding. This is only my second day of trying to learn CSS.

    Thanks.

  106. Emil Stenström 22 Oct

    106

    @Brad: The syntax you use in the CSS file is completely different from HTML. In CSS you use: background: url(image.jpg); and in HTML you use <img src=”image.jpg”>. CSS is a new language, specially made to work better for design.

  107. Louise 26 Oct

    107

    I’m in Brad’s age-group so I relate! First step for me was to change my thinking… think design of the website first, like you would design it on paper, this is the CSS page (you can include all your notes in this style sheet, i.e. from building the skeleton, column layout, color & size, to color, size & style of fonts, alignment of Images & Text). Than I had to buy a book for reference, once you get it, than you really appreciate it (but I’m still learning)!

  108. Louise 26 Oct

    108

    Forgot to add this (old age) for my comment to Brad. I had to buy a reference book to learn all the ‘CSS syntax’ from design to attributes, values, and tags.

  109. Tony 27 Oct

    109

    Good stuff. You have a fan here.

  110. Dhiraj Patra 30 Oct

    110

    Nice tutorial. Hope next added will be a full lenght css file for especiall Ajax implementaion, like borderless input text boxes with some valuable styles. Thanks.

  111. Thanh 31 Oct

    111

    Thanks alot for the tutorial!!! cuz it helps me realize all the stuff that I’ve done wrong while coding HTML. Thanks to this tut, I know how to fix my probs!!! ^_^

  112. Pozycjonowanie 4 Nov

    112

    I am a java developer and always been a little wary of divs and css. That guide makes perfect sense and is concise. Excellent and thanks.
    Keep up the good work. Greetings

  113. hano 6 Nov

    113

    got a good idea of CSS after going through the tutorial.
    thanks for keeping it simple

  114. Mario Castillo 28 Nov

    114

    Typing error in my previous comment (#120), I was trying to ask if it is posible to use “a href” with target attribute inside a div in CSS to obtain the same result (loading a file in other div keeping untouched the rest)as using “a href” with the target attribute in frames.

    Sorry for the mistake, I am not native english speaker, and my HTML is very basic.

  115. Emil Stenström 28 Nov

    115

    @Mario Castillo: Hi Mario! I removed the previous comment, no problem.

    It’s not possible to load a page into a div like that. What people use is some kind of server-side language like PHP, ASP or something. With those languages you can add content to your pages before sending them to the user.

  116. Mario Castillo 2 Dec

    116

    Thanks Emil, what about using @import ’stylesheet.css’
    inside the style tag instead of using the most common “link rel…” to tell HTML code where to look for the CSS?
    Is this a good practice when thinking about usability in different browsers?

  117. Emil Stenström 3 Dec

    117

    @Mario Castillo: The only reason to use @import is that older version of browsers, like Netscape 4, does not support that command. That means that you will get no stylesheet at all in those browsers instead of a broken one.

  118. Andy 9 Dec

    118

    This is pretty good tutorial, its a really good starter tutorial. I thinks it explains well the chracterisrics of CSS.
    Cheers

  119. Hugh Scheffy 9 Dec

    119

    Very concise, clear and useful. Thanks.

  120. Prosadia 13 Dec

    120

    I love your article. I’ve just start learning CSS a few minutes ago, and i found your article is very easy to understand.

  121. suresh joshi 5 Jan

    121

    Very Well Written.

  122. Hochzeitsmode 7 Jan

    122

    Hi Emil, I just found your tutorial via google. Seems to be very usefull, but I still don`t understand why no one try to develop an easy language that makes it possible to write pages without that knowledge. But till this happens, we all are happy about your tutorial ;-))

  123. Aukcje 28 Jan

    123

    Thanks for this very good article … Can i translate this and insert on my site in Poland? … Thanks

  124. Emil Stenström 29 Jan

    124

    @Aukcje: As long as you link back to this article in the beginning of your translation it’s OK. Glad to see you like it!

  125. Meble 31 Jan

    125

    Emil: Can i too add this on mysite? Your side has very helpful articles.
    Thanks and best regards

  126. Emil Stenström 2 Feb

    126

    @Meble: You can link to it, but you can not copy it, no.

  127. kadir guler 6 Feb

    127

    hi
    your site is very good

  128. Angelita Dumapias 7 Feb

    128

    What a tutorial! Thanks! a lot… I hope that I could customize the appearance of the web page I’m working on.

  129. Christine Wyndham-Thomas 9 Feb

    129

    Thank you for this site.

    I need to re-do my site and because it’s very large have decided to learn CSS. Also, more of the advanced browsers only recognise CSS.

    A little hard getting my head around it, but hopefully your site will go a along way to helping me with this.

    Once again, thanks for a very informative site.

  130. Kolektory 18 Feb

    130

    Very Well Written.

  131. Romina Miersch 21 Feb

    131

    Great and excellent article t’s realy helpful. Thanks again.

  132. Frank 23 Feb

    132

    The only reason to use @import is that older version of browsers, like Netscape 4, does not support that command. That means that you will get no stylesheet at all in those browsers instead of a broken one.

  133. James W. Hudgens 4 Mar

    133

    I published my first web page in 1994. Reading your CSS tutorial sends me back to the first grade. I have gotten lazy over the years and been using frontpage not worrying much about code. I want to be a better page builder so I will stick with this and learn it. Thank you for your article and the baby steps you took me through. CSS looks very powerful.

  134. Emil Stenström 5 Mar

    134

    @James: Thanks for commenting, it’s always nice to hear that my little writings help real people!

  135. Kroq 11 Mar

    135

    Hey thanks for the straightforward explanation … CSS is still a mystery to me but I’m figuring it out :)

  136. Stron 20 Mar

    136

    Fantastic article covering some points I really needed some good usability info for. Thanks

  137. heinz 6 Apr

    137

    People use CSS2 all the time, and they even already use parts of WHATWG HTML5 (like the CANVAS element, or contentEditable).
    I do not believe that the W3C HTML WG will complete recommendation status by 2008; and neither do I believe that that WG shall be disbanded late 2010.
    Specification are usable before being finished but not before those parts are incorporated into User Agents, e.g., browsers. Safari, Mozilla and Opera (since they’re the copyright holders) may be the first to include HTML5 elements and attributes once they become stable, Right?

  138. Telezakupy 15 Apr

    138

    It’s all good… but there are still things that you can’t do with CSS but can with tables…

  139. Emil Stenström 15 Apr

    139

    @Telezakupy: And the other way around, CSS is MUCH more flexible than tables.

  140. linda 17 Apr

    140

    this was a great help. the only thing I would ask is to add some trouble shooting tips based on common problems.

  141. Gloria Jean 20 Apr

    141

    This is a really great article and a great site. I am a big fan of web standards. I linked to this article from http://www.bacaracka.com/ (which is a site I could call “beginning web page design for dummies,” but I would not want to insult my sister and friends who are the people I am doing it for. Thanks for your site, I will be coming back many times!

  142. Emil Stenström 21 Apr

    142

    @Gloria Jean: Thanks for the link!

  143. Dominick 6 May

    143

    Hey, great tutorial! This was very helpful to me.

  144. Srebro 25 May

    144

    The sites shown here are visually appealing. The use of css to handle the layout, graphics, backgrounds, links is very well handled. The only issue is the css over takes the message and clouds the content. Sometimes simplicity can speak volumes. Our initial designs for our firms site looked very similar to all the ones shown here. Is that a coincidence. I don’t think so. The web-designer was referencing these sites for layout ideas. I think that is common amongst many designers these days. There is so much out there that looks fantastic, that one feels the urge to do it themself. Most web 2.0 sites look the same. I think we can all agree on that.

  145. JAY TANNA 8 Jun

    145

    Is there any way to download the complete beginner’s Guide to CSS in a pdf format? I tried to print it page by page but it seems to pprint 28 pages for each part (4 parts times 28!!!!). Clearly some of us are not interested to print comments of users.

    Regards,

  146. Emil Stenström 11 Jun

    146

    @JAY TANNA: It’s not yet available and I’m sorry I have not made a better print stylesheet. My best recommendation right now is to print but make sure you only do it with the first X pages that contain the article. I’ll make a print-version on the next version of the site, I promise.

  147. Vicky Affluence 27 Jun

    147

    Hello Emil,
    Many thanks for the tutorial on css. I have been trying to develop a new website for my biz and have not made much progress until I came across your link at w3c. The tutorials are well written and self explanatory. I have started work on the site since two days now using css. I am very impressed with the coding method of css, and more grateful to you for putting the tutorial on the net for all to learn from.
    One question though: how do I define image properties, , say I want to place a transparent image of size h=140 w=200 on the right side of the screen, or inside a table with texts b4 and after.
    Thanks and keep up the good work.
    Vicky

  148. Emil Stenström 27 Jun

    148

    @Vicky Affluence: Start with your content in the HTML. Two paragraphs of text and an image: <p>text</p><img src=”" width=”100″ height=”200″><p>text</p>. Image size are set directly in the HTML since image do no make sense without a size (and browsers are very bad at resizing… Good luck!

  149. Serg 15 Jul

    149

    Good to hear! Don’t give up and go back to tables, it’s not worth it I promise.

  150. guzel sozler 20 Jul

    150

    Is there any way to download the complete beginner’s Guide to CSS in a pdf format? I tried to print it page by page but it seems to pprint 28 pages for each part (4 parts times 28!!!!). Clearly some of us are not interested to print comments of users.

    Regards,

  151. Emil Stenström 21 Jul

    151

    @guzel sozler: sorry, but there’s currently no way to print articles without comments. I will tend to that in the next version of the site, but that’s a couple of weeks away.

  152. Beau Dure 2 Sep

    152

    This is terrific. I haven’t seen a better explanation of the fundamentals.

  153. Samaar 12 Sep

    153

    Thank you for providing us of this user-friendly guide, it really helped me out. I just started using CSS, and I find it much easier after this. Thanks

  154. Kajuju 22 Sep

    154

    Hej! Your site is great. Well I have a question that I hope you can help me with. I have three different id’s (header, middle and footer). They all have different links and I need the links to be in different colors. Example: the header can have the color red, the middle blue and footer purple. How do I do that in CSS? Thanks again for a great site.

  155. Emil Stenström 22 Sep

    155

    @Kajuju: #header a { color: blue; } and #middle a { color: red; } and so on. That will only match the links inside those ids. Hope you get it to work!

  156. Becca Ulyatt 9 Oct

    156

    Thank you ever so much for your words of wisdom. Just getting into the insanity of Web Design and CSS. Your explanations are simple enough, even for me, to understand!! Thanks again!

  157. Cep Telefonu Tamiri 30 Dec

    157

    Thank you all

  158. Paris Hilton 30 Dec

    158

    Best comment for writing for css thanks best regards

  159. dos games 30 Dec

    159

    thanks

  160. rich 17 Jan

    160

    Awesome tutorial on css, Ive used this as a reference a bunch of times, keep the great articles coming.

  161. Hans 24 Jan

    161

    CSS is a must today for web design. Good explanation.

  162. Ellinor 2 Feb

    162

    Hej! Ville bara säga att denna sida hjälp mig mkt i kursen Webbdesign, tack!

  163. Frugal Wizard 14 Feb

    163

    Great information! You make it sound almost doable but I am old school html and have not ventured into the world of CSS. I will try it out though.

    Thanks

  164. Technique 13 Mar

    164

    Nice. I am currently planning a re-design for my site and this helps develop my understanding for when I talk to web designers.

    Cheers!

  165. oltimemom 6 Apr

    165

    Thank you. You should write a book.

  166. mynet 8 Apr

    166

    I am finally finishing up my college education (started in the fall of ‘65) all online, and one of my courses this semester requires us to submit three papers on topics of our choice, within limits of the course, but they must be formatted with HTML, and the paper due next week must also use CSS and Meta tags. My discovery of your article(s) couldn’t have come at a better time. And the info is simple enough that us older newbies can understand and use it.

  167. Bhavya 9 Apr

    167

    Hi,
    It’s one of the most neat article I have ever read. It’s a great article on CSS, the concepts were very clear. It was also fun reading them. Thank you for a wonderful articles on CSS for beginners.

  168. film indir 27 Apr

    168

    thanks

If you want to you can follow the disussion through a comment feed.

add comment

This is the place where you get to say your opinion about this article, use it well. Formating with HTML is allowed. A red asterisk means that the following field is required.

Comment Form




Comment Form