fresh photoshop tutorials & resources
Log in Register
Painted Wood Photoshop Action Comics Book Photoshop Action Infographic JS Library Rays of Light Photoshop Action

What is CSS and How to Use Style Sheets for Web Design

www.psd-dude.com
Tutorials CSS 8010 Views September 3rd, 2011

As many of our friends already know this blog is maintained by a team of two: one graphic designer and one programmer - me. Therefore, I've decided to start writing a new type of tutorials related to web design technologies and coding to share my experience with you.

My first tutorial is for beginners and from it you can learn about what CSS is and how can you use style sheets for your web designs.

Please don't hesitate to leave comments in the comments area below and I will try to answer all your questions related to this tutorial and to CSS style sheets basics.

Advertisment

What is CSS?

CSS or Cascading Style Sheets is a language for defining how HTML elements are displayed. CSS properties define visual representation rules for HTML elements like font size, color, alignment, etc.

Why use CSS?

You might think that you have never used and don't need CSS, but the fact is that even the text you are now reading has style sheet properties set to it. Some of them are explicitly set (by me, hehe) and some are implicitly set (these are the default browser style sheet properties). These properties indicate for this paragraph of text the font family, font size, color, text alignment, indentation, distance between text lines -  so you can see, CSS style sheets really do a lot for the design of a page.

Actually, you can't do web design without using CSS style sheets toghether with HTML elements. From the layout to the look and feel, CSS style sheet properties are the mean of setting how the web design of the page will look like.

Basic CSS usage tips:
Where do I begin with CSS?

Ok, so you have a HTML for your web design and would like to know how you can use CSS style sheets to modify certain visual aspects of the design. For the sake of an example let's say we have decided to change the font face of the page. Note that by default your browser will set the font face and the font size - for example Internet Explorer and Firefox have by default "Times New Roman" as the font face.

3 ways to set CSS style sheet properties

1. Inline style sheet properties - this is the quickest way to use CSS styles in your web design. To use inline CSS styles you only have to add the "style" attribute to the HTML element for which you want to change the CSS style sheet properties. For our example to change the font face of the page we'll want to change it for the "body" element. Here's the code that shows you how to do it.

    <html> 
        <head> 
            ... 
        </head> 
        <body style="font-family:Arial;"> 
            ...
        </body> 
    </html>

As you can see on line 5, I've added the style attribute for the body tag in which I've placed the property "font-family" which determines the font face and the desired value "Arial". The CSS property and the value are separated by a colon sign (:) and to indicate the end of setting the property I've placed a semi-colon(;).

2. Add CSS styles through the <style> tag. This is the second way through which you can add CSS styles to your web design. The <style> tag is a tag that is placed usually in the <head> tag of the page, but can also be placed anywhere on the page (though not recommended). Here is the code snippet that shows how to achieve the same result as above for our font face example.

    <html> 
        <head> 
            ...
            <style>
            body
            {
                font-family:Arial;
            }
            </style>
            ... 
        </head> 
        <body> 
            ...
        </body> 
    </html>

Lines 4 to 9 indicate to the browser that we would like to set the font face for the <body> tag. As you might notice, the CSS styles on line 7 is exactly the same as in the inline style - method 1. The difference is that with this second method you have to specify for which element you want the styles applied, this is why you have to put "body" as I did on line 5. This part of the CSS style sheet is called a CSS selector.

Part 1Part 2

If you're looking for an effective way to learn with Photoshop fast, explore Envato Elements, the Netflix of designers and its 1000+ courses. Apart from getting state-of-the-art educational material right at your fingertips, you also get the key to a growing digital library of 22,000+ hand selected items with unlimited downloads for just $29 per month!

Be a Cool Dude!

With your donation you can help us maintain this website and keep producing free resources many months to come! Any amount counts

3 comment(s) for "What is CSS and How to Use Style Sheets for Web Design"

PSDDude
5:23 AM Thursday, September 08, 2011
You are right "Some Guy", but even so, I thought I should list all possibilities. And I also think that sometimes poor coding can be an acceptable compromise for a quick solution. reply
Web Design Canterbury
5:33 PM Sunday, September 25, 2011
Excellent Tutorial & Very helpful for designers like me :),

Thanks for your tutorial . reply
Some Guy
Some Guy
1:30 AM Tuesday, December 23, 2014
External stylesheet is better for 99.9999% situations. Other is poor coding. reply

Have something to say? Leave us a comment

Click to Upload Fan Art!

Share your Psd Dude inspired works


Pencil Sketch vs Camera Photo Effect Photoshop Action
Animated Kaleidoscope Photoshop Action
Recent Posts
Learn how to create The Mummy movie poster effect in Photoshop. We'll create an evil woman character...
New collection of free water textures that you might want to add to your design resources box. The l...
Learn how to create a fairy pixie dust magic trail in Photoshop using overlay textures, blending tec...
Download our new set of circle brushes which contains 30 circles drawn in Photoshop. Making a circle...

      Painted Wood Photoshop Actions
Popular Posts
You can create amazing gold text effects by using these unique gold Photoshop styles, both free and ...
There's something about ribbons that just looks good. I thought about making this Ribbon Vector Free...
In today list of free textures for Photoshop I have gathered over 100 amazingly beautiful wood textu...
I have decided to create a new character from Alice in Wonderland and I hope that maybe someday to r...
Today's list is a collection of Free Photoshop Layer Styles. As many of you already know, Photoshop ...
If you want to know how to create dispersion effect in Photoshop in a easy way, here is a quick solu...
To create a Comic Book Effect in Photoshop we have to mix all sort of filters and blend them togethe...
Hello girls and boys! Today i want to make a cartoon rainbow... i really hope you will like it! ...
Stitching and sewing can be created also in Photoshop with very realistic results. So in this tutori...
In this tutorial I will show you how to create a 3D map in Photoshop using different 2D and 3D model...
Subscribe via email
LIKE US ON FACEBOOK

      Dispersion with Real Images Photoshop Action
top