360haven works best with JavaScript enabled
CSS Id and Class
Loading
Register
Results 1 to 1 of 1
  1. #1
    DEADBEEF

    JizzaBeez is offline
    Join Date : Nov 2010
    Posts : 777
    Array

    CSS Id and Class

    The id and class Selectors

    In addition to setting a style for a HTML element, CSS allows you to specify your own selectors called "id" and "class".


    The id Selector

    The id selector is used to specify a style for a single, unique element.
    The id selector uses the id attribute of the HTML element, and is defined with a "#".
    The style rule below will be applied to the element with id="para1":
    Code:
    #para1
    {
    text-align:center;
    color:red;
    }
    Try it yourself Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.


    The class Selector

    The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.
    This allows you to set a particular style for any HTML elements with the same class.
    The class selector uses the HTML class attribute, and is defined with a "."
    In the example below, all HTML elements with class="center" will be center-aligned:
    Code:
    .center {text-align:center;}
    Try it yourself



    You can also specify that only specific HTML elements should be affected by a class.
    In the example below, all p elements with class="center" will be center-aligned:
    Code:
    p.center {text-align:center;}
    Try it yourself Do NOT start a class name with a number! This is only supported in Internet Explorer.

  2. The Following User Says Thank You to JizzaBeez For This Useful Post:


 

 

Similar Threads

  1. Dragon Age 2 DLC provides a touch of class to each class
    By jkipp82 in forum Xbox 360 Game News
    Replies: 0
    Last Post: 04-28-2011, 02:39 PM
  2. Help with CSS/HTML
    By Mocha in forum Discussion and Help
    Replies: 4
    Last Post: 03-30-2011, 12:58 AM
  3. CSS Font
    By JizzaBeez in forum Tutorials and Resources
    Replies: 0
    Last Post: 03-03-2011, 08:14 AM
  4. CSS Text
    By JizzaBeez in forum Tutorials and Resources
    Replies: 0
    Last Post: 03-03-2011, 08:04 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.
     

About 360haven

    360haven is an Forum Devoted To Game modding Fans from all over the world.

    An Awesome Community of Xbox 360 Gamers, Modders and Developers who Create & Share Tutorials, Applications, Gfx, Trainers and Gamesaves.

    A haven for the l33t.
    A scarce paradise for modders.

Like this page

Google+