20 Useful CSS Tips For Beginners

n the old days, we depend a lot on developers and programmers to help update the website, even when it’s just a minor one. Thanks to the CSS and it’s flexibility, styles can be extracted independently away from the codes. Now, with some basic understanding of CSS, even a novice can easily change the style of a website.

Whether you are interested in picking up CSS to create your own website, or merely to tweak your blog’s look and feel a little – it’s always good to start with the fundamentals to gain a stronger foundation. Let’s take a look at some CSS Tips we thought might be useful for beginners.

Use reset.css

When it comes to rendering CSS styles, browsers like Firefox and Internet Explorer have different ways of handling them. reset.css resets all fundamental styles, so you starts with a real blank new stylesheets.

Here are few commonly used reset.css frameworks:

  • Yahoo Reset CSS
  • Eric Meyer’s CSS Reset

Use Shorthand CSS

Shorthand CSS gives you a shorter way of writing your CSS codes, and most important of all – it makes the code clearner and easier to understand.

More related:

  • Introduction to CSS Shorthand
  • Useful CSS shorthand properties

Understanding Class and ID

These two selectors often confuse beginners. In CSS, class is represented by a dot “.” while id is a hash ‘#”. In a nutshell id is used on style that is unique and don’t repeat itself, class on the other side, can be re-use.

More related:

  • Class vs. ID
  • When to use Class, ID

Power of <li>

<li> a.k.a link list, is very useful when they are use correctly with <ol> or <ul>, particulary to style a navigation menu.

Forget <table>, try <div>

One of the greatest advantage of CSS is the use of <div> to achieve total flexibility in terms of styling. <div> are unlike <table>, where contents are ‘locked’ within a <td>‘s cell. It’s safe to say most <table> layouts are achievable with the use of <div> and proper styling, well maybe except massive tabular contents.

More related:

  • Tables are dead
  • Tables Vs. CSS
  • CSS vs tables

CSS Debugging Tools

It’s always good to get instant preview of the layout while tweaking the CSS, it helps understanding and debugging CSS styles better.

Here are some free CSS debugging tools you can install on your browser:

  • FireFox Web Developer
  • DOM Inspector
  • Firebug

Power of <li>

<li> a.k.a link list, is very useful when they are use correctly with <ol> or <ul>, particulary to style a navigation menu.

Forget <table>, try <div>

One of the greatest advantage of CSS is the use of <div> to achieve total flexibility in terms of styling. <div> are unlike <table>, where contents are ‘locked’ within a <td>‘s cell. It’s safe to say most <table> layouts are achievable with the use of <div> and proper styling, well maybe except massive tabular contents.

More related:

  • Tables are dead
  • Tables Vs. CSS
  • CSS vs tables

CSS Debugging Tools

It’s always good to get instant preview of the layout while tweaking the CSS, it helps understanding and debugging CSS styles better.

Here are some free CSS debugging tools you can install on your browser:

  • FireFox Web Developer
  • DOM Inspector
  • Firebug
firebug

Avoid Superfluous Selectors

Sometimes your CSS declaration can be simpler, meaning if you find yourself codingADVERTISEMENTjavascript:window[‘contents’] the following:

12345ul li { ... } ol li { ... } table tr td { ... }

They can be shorten down to just

123li { ... } td { ... }

Explanation: <li> will only exist within <ul> or <ol> and <td> will only be inside <tr> and <table> so there’s really not necessary to re-insert them.

Knowing !important

Any style marked with !important will be taken into use regardlessly if there’s a overwriting rule below it.

1.page { background-color:blue !important; background-color:red;}

In the example above, background-color:blue will be adapted because it’s marked with !important, even when there’s a background-color:red; below it.

!important is used in situation where you want to force a style without something overwriting it, however it may not work in Internet Explorer.

Replace Text with Image

This is commonly practice to replace <h1>title</h1> from a text based title to an image. Here’s how you do it.

123456h1 {text-indent:-9999px;background:url("title.jpg") no-repeat;width:100px;height:50px;}

Explanation: text-indent:-9999px; throws your text title off screen, replaced by an image declared by background: {...} with a fixed width and height.

Understand CSS Positioning

The following article gives you a clear understanding in using CSS positioning – position: {...}

Related: Learn CSS Positioning in Ten Steps

CSS @import vs <link>

There are 2 ways to call an external CSS file – respectively using @import and <link>. If you are uncertain which method to use, here’s few articles to help you decide.

Related: Difference Between @import and link

Designing Forms in CSS

Web forms can be easily design and customize with CSS. These following articles show you how:

Related: Table-less formStyling even more form controls

design forms css

Get Inspired

If you are looking around for nicely designed CSS-based website for inspiration, or just simply browsing to find some good UI, here are some CSS showcase site we recommend:

  • CSS Mania
  • CSS Leak

Keep CSS Codes Clean

If your CSS codes are messy, you are going to end up coding in confusion and having a hard time refereing the previous code. For starters, you can create proper indentation, comment them properly.

More – 12 Principles For Keeping Your Code CleanFormat CSS Codes Online

Typography Measurement: px vs em

Having problem choosing when to use measurement unit px or em? These following articles might give you a better understanding on the typography units.

CSS Browsers Compatibility Table

We all know each browser has different ways of rendering CSS styles. It’s good to have a reference, a chart or a list that shows the entire CSS compatibility for each browser.

CSS support table: #1#2#3

css table

Design Multicolumns in CSS

Having problem getting the left, middle and right column to align properly? Here are some articles that might help:

  • In Search of the Holy Grail
  • Faux Column
  • Litte Boxes (examples)
  • Multi-Column Layouts Climb Out of the Box
  • Absolute Columns
multicolumns

Get a Free CSS Editors

Dedicated editors are always better than a notepad. Here are some we recommend:

More:

  • Simple CSS, Notepad ++
  • A Style CSS Editor

Top 10 CSS Editors [Review]

Top 10 CSS Editors [Review]

CSS is a simple language that it does not need a special editor to write. But having the…Read more

notepad plus

Understanding Media Types

There are few media types when you declare CSS with <link>. print, projection and screen are few of the commonly used types. Understanding and using them in proper ways allow better user accessibility. The following article explains how to deal with CSS Media types.

More:

  • CSS and Media Types
  • W3 Media Types
  • CSS Media Types

Source: https://www.hongkiat.com/blog/20-useful-css-tips-for-beginners/

40 thoughts on “20 Useful CSS Tips For Beginners

  1. recep ivedik ,

    Thanks so much for the blog article. Thanks Again. Fantastic. Marcille Austin Andrej

  2. film izle ,

    Article writing is also a excitement, if you be familiar with then you can write if not it is difficult to write. Gleda Lyn Newby

  3. full hd izle ,

    Sweet internet site , super design and style , really clean and utilize genial . Harri Roger Milda

  4. free sex ,

    I love looking through a post that can make people think. Imogen Jon Hum

  5. dublaj ,

    This article will help the internet people for setting up new website or even a blog from start to end. Editha Saunderson Maddox

  6. bollywood ,

    Very interesting information!Perfect just what I was searching for! Willy Killie Dugas

  7. netflix ,

    Pretty! This has been a really wonderful article. Thank you for supplying this information. Dorita Cordy Leno

  8. watch ,

    sakirt tvde yayinlanan ilk kez izlenen sikis filmi Christal Victor Daisy

  9. 720p ,

    Thanks for sharing, this is a fantastic blog post. Thanks Again. Cool. Alexina Timothy Ewold

  10. watch ,

    whoah this blog is excellent i love reading your posts. Keep up the great work! You know, many people are hunting around for this information, you can help them greatly. Karina Willis Sharron

  11. dublaj ,

    that will be the finish of this report. Here youll uncover some web sites that we believe youll enjoy, just click the hyperlinks over Gwenora Garry Moriyama

  12. yabanci ,

    You have brought up a very great details, appreciate it for the post. Blancha Moises Lord Hermia Briggs Chem

  13. anime ,

    Greate article. Keep writing such kind of info on your blog. Lorie Jodie Bricker

  14. anime ,

    Having read this I thought it was extremely informative. I appreciate you spending some time and effort to put this article together. I once again find myself spending way too much time both reading and commenting. But so what, it was still worth it! Jilly Ev Tom

  15. watch ,

    I am so grateful for your article. Really thank you! Really Cool. Maye Mark Royal

  16. bedava ,

    Substantially, the post is actually the greatest on this worthw hile topic. I harmonise with your conclusions and also will thirstily look forward to your coming updates. Simply just saying thanks will certainly not simply be adequate, for the extraordinary lucidity in your writing. I can right away grab your rss feed to stay abreast of any kind of updates. Fabulous work and also much success in your business enterprize! Florence Waverly Redman

  17. turkce ,

    Thanks, Jas. Connemara was the highlight of our Ireland trip and I would urge everyone to go see it. Alverta Dirk Britton

  18. turkce ,

    Good post. I will be facing a few of these issues as well.. Patrica Everard Phil

  19. turkce ,

    What as up, just wanted to tell you, I liked this blog post. It was funny. Keep on posting! Stephani Alexandro Maddox

  20. turkce ,

    I visited many blogs but the audio feature for audio songs current at this web site is actually wonderful. Helga Zolly Bosson

  21. turkce ,

    Greetings! Very helpful advice in this particular article! It is the little changes which will make the greatest changes. Thanks for sharing! Coleen Garry Euphemiah

  22. turkce ,

    This is a excellent site, would you be interested in doing an interview regarding how you created it? If so e-mail me! Lenka Russell Ewart

  23. turkce ,

    This is a terrific app. So far I have a list of over 50 photographers whose work I love to look at and learn from, over 1700 photos! Now I am beginning to collect images of famous painters whose work I admire. What a great learning tool. Naomi Reggis Harty

  24. turkce ,

    I appreciate you sharing this article post. Thanks Again. Great. Guenna Ernestus Washko

  25. turkce ,

    As soon as I discovered this web site I went on reddit to share some of the love with them. Koralle Murray Moitoso

  26. turkce ,

    When the diet cet results will be declared plz sir/madam chepandi Ofilia Lionel Gilberto

  27. turkce ,

    After I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive 4 emails with the same comment. Perhaps there is a means you can remove me from that service? Thank you! Dulciana Hilario Zerline

  28. turkce ,

    An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers Rosamund Justen Zilvia

  29. turkce ,

    I have learn some excellent stuff here. Certainly value bookmarking for revisiting. Retha Marty Kenyon

  30. turkce ,

    Way cool! Some extremely valid points! I appreciate you writing this article and also the rest of the website is really good. Dorolisa William Melinde Jacenta Bronnie Risley

  31. turkce ,

    I know this web page presents quality dependent content and other material, is there any other website which gives these data in quality? Didi Feodor Kipper

  32. turkce ,

    Really good to see something like this here. To say the truth, this information is quite invaluable to me.being a beginner marketer, learning about secrets like this are things that can help to shorten my learning curve and help deliver results in time. Surely this is worthwhile to see and respect here for your efforts. Thanks for sharing here with us Astra Forbes Sjoberg

  33. turkce ,

    I am constantly searching online for posts that can benefit me. Thanks! Elspeth Ric Yurt

  34. turkce ,

    Use the same ball skills for several plays to establish a pattern of play. Dinah Galen Riba

  35. turkce ,

    Simply wanna comment on few general things, The website design is perfect, the articles is really excellent : D. Felipa Clayborn Shelden Elise Delaney Martell

  36. turkce ,

    I simply could not go away your web site prior to suggesting that I really enjoyed the usual info an individual provide on your guests? Is gonna be again frequently in order to check out new posts Sara-Ann Marten Pepper

  37. erotik ,

    Do you have a spam issue on this website; I also am a blogger, and I was wanting to know your situation; many of us have developed some nice methods and we are looking to exchange solutions with others, please shoot me an email if interested.| Helaine Findlay Scopp

  38. erotik ,

    I would like to express my respect for your generosity in support of those people that really want help on this subject. Your personal dedication to getting the message all over was incredibly valuable and have specifically made guys and women much like me to arrive at their objectives. Your amazing helpful useful information can mean a whole lot to me and much more to my colleagues. Thanks a lot; from all of us. Felice Emile Sudbury

  39. BYPASS SHELL ,

    Hey! I just wanted to ask if you ever have any trouble with hackers?

    My last blog (wordpress) was hacked and I ended up losing many
    months of hard work due to no backup. Do you have any methods to protect against hackers?

  40. Alan ,

    Hello there! This post could not be written much better!
    Looking at this post reminds me of my previous roommate! He always kept talking about
    this. I am going to send this post to him. Pretty sure he will
    have a great read. Thanks for sharing!

Comments are closed.