Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    css tags and attributes what are they used for

    im working on ccs and i am not to sure what the following tags and arrtibutes are used for or what they are. can someone please help me and and explain? i have looked at several websites but still no clue. the websites use the css files using it but never go into detail of what they are

    style

    link

    type

    rel

    thank you

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by haydar View Post
    im working on ccs and i am not to sure what the following tags and arrtibutes are used for or what they are. can someone please help me and and explain? i have looked at several websites but still no clue. the websites use the css files using it but never go into detail of what they are

    style

    link

    type

    rel

    thank you
    style:
    You use style inside of the HTML file (never in the external CSS file). You place this "attribute" inside of the <tag> you want to style. This is used for what is called "in-line CSS" and it is implemented like this:
    Code:
    <div style="background-color:yellow;color:red;">...</div>
    It's mostly useful during development but you should remove it wherever possible from finished products and style elements in the external CSS using ID's and classes instead.


    link:
    Link is a <tag> of its own, just like div, ul, li, and so on. It is used in the HTML to link other items to the current document and requires two other items in your list, so I will wait until then to post the example code. Most often, link <tags> are used to associate an external CSS file to style the elements of the current page.

    type:
    This is an "attribute" that is used for script and link tags to let the browser know what language the script or linked item is written in. Most often you will see it done like this for javascript (I'll show you the use with link tags in a minute):
    Code:
    <script type="text/javascript">...</script>
    rel:
    Ok, this is an "attribute" used for link <tags> and it tells the browser what the relationship is of the linked item to the current HTML document. Most commonly you will see this for external CSS files. The combined link and rel code usually looks like this:
    Code:
    <link rel="stylesheet" type="text/css" href="http://www.xxxxxxxxx.com" />
    A good place to find answers and examples of these and other issues is at http://www.w3schools.com
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •