Welcome to WebDesignForums.net!
You're currently viewing WDF as a guest. By registering for a free account, you'll be able to participate with other members in our friendly community. Being a member allows you to ask questions and get answers for those troublesome web development tasks!

In addition, as a member you'll be able to post your websites up for review. Using our unique website review system you can gain some amazing feedback from some of the best web developers around. This is a completely free service to all registered members.

Ready to register yet? Registration is 100% free. Click Here To Join Now!

Basic CSS

Discussion in 'Coding Articles & Tutorials' started by infiniti, Aug 3, 2006.

  1. Offline

    infiniti New Member

    Message Count:
    146
    Likes Received:
    1
    Trophy Points:
    0
    Basic CSS

    To make a page now the best way is html with css not just html. It is very easy to style all the elements of your page. Here are the basic atributes to to elements you can style, remember to end all of these in semi-colons:



    background: either enter a color-code or url(path/to/image.type);

    border: thickness solid color;
    Replace thickness with a pixel value, leave solid as solid, and replace color with a hex code such as #ffffff or white. To further customize this you can make the different sides of the border different colors, only have a left border, etc. To do this; change "border:" to "border-top:", "border-left:", "border-right:", or "border-bottom:".

    margin: amount;
    Replace amount with a pixel value. To further customize this you can specify where you want to have this property in effect. To do this use this format:
    property-direction: atributes;
    Replace property with your property or here it is margin. Next, replace direction with top, bottom, left, or right.

    padding: amount;
    Replace amount with a pixel value. To further customize this you can specify where you want to have this property in effect. To do this use this format:
    property-direction: atributes;
    Replace property with your property or here it is padding. Next, replace direction with top, bottom, left, or right.

    width: amount in pixels;

    height: amount in pixels;

    color: hex code for color;

    font-size: size in pixels;

    font-famliy: name of font;

    text-align: either left, right, or center;



    All of these can be used to style basic elements of a site. These elements are:
    body, p, a:link, a:active, a:visited, a:hover, h1, h2, h3, h4, h5, div, span, table, tr, td, font, etc.

    The basic format is:
    Code:
    element{
    atribute: property;
    atribute: property;
    atribute: property;
    }


  2. Offline

    designminds New Member

    Message Count:
    13
    Likes Received:
    1
    Trophy Points:
    3
    Gender:
    Male
    Location:
    Bay City, Michigan, United States
    And for code cleanliness and ease of further editing, if it can be, make the CSS and external file and then include it in the header:

    Code:
    <link rel="stylesheet" type="path/to/your/css/file.css" />
    
    I prefer to use the newer "html5" directory structure:

    >main directory-
    -->assets
    ------>img
    ------>css
    ---------->file.css
    ------>js
    >index.html

    So..
    Code:
    <link rel="stylesheet" type="assets/css/file.css" />
    
    This would be the path the CSS file.


  3. Offline

    m3n0tu18 WDF Moderator and Drupalite!

    Message Count:
    1,373
    Likes Received:
    248
    Trophy Points:
    63
    Gender:
    Male
    Location:
    New York
    Actually you will still need Pixels even for responsive layouts. min-width:*something*px is better than using min-width:*something*%


    Jaycbrf4 likes this.
  4. Online

    AlphaMare WDF Moderator

    Message Count:
    3,970
    Likes Received:
    720
    Trophy Points:
    113
    Gender:
    Female
    Location:
    Montreal, Canada
    I tend to use percentages and em rather than px, it requires more calculations but it remains consistent throughout the design.


    m3n0tu18 likes this.
  5. Offline

    SimplyWebsites New Member

    Message Count:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Leicester
    Remember when we didn't use CSS... woah


  6. Online

    AlphaMare WDF Moderator

    Message Count:
    3,970
    Likes Received:
    720
    Trophy Points:
    113
    Gender:
    Female
    Location:
    Montreal, Canada
    I remember using HotMetal as my first editor...later switched to Netscape Composer due to the requirements of the school I was at - and I've disliked WYSIWYGs ever since!


  7. Offline

    Noteleklabs Active Member

    Message Count:
    173
    Likes Received:
    27
    Trophy Points:
    28
    Gender:
    Male
    Location:
    NC
    CSS FTW btw as mentioned above several times, you should always use % so when you resize your browser or are on a different screen size your design looks the same


Share This Page