Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2006, 07:06 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default purpose of hash in CSS style

Code:
#load {position: absolute;top: 50;left: 0;height: 200%;width: 100%;background-color: #f5f5f5;}
.loading {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:-2;"}
What is the purpose of the hash?

Regards,
Picco

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old January 20th, 2006, 10:32 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

The hash is an id selector. So, somewhere in the body there is an id name of "load" like so:

<div id='load'>

Where as the dot is a class selector, and references an element with a class name of "loading" like so:

<div class="loading">

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old January 20th, 2006, 10:52 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

In CSS you can identify what a style applies to in 3 ways (from a basic level):

1. Tag name: Type just the letters of the tag the style applies to:
    TD{
       background-color: #FF0000;
    }

2. Class name. Identify the tag's class that the style applies to. For this you need to specify the class in the element's markup (<TD class="RedBG">):
    .RedBG{
       background-color: #FF0000;
    }

3. Object ID. Identifies a specific element by ID to which the style applies. For this you specify the tags ID attribute (<span id="PageHeader">):
    #PageHeader{
       font-size: 36px;
       color: #00FF00;
    }
Usually, you would have only one element with that ID on the page otherwise you'd have a ID conflict that could cause other problems.

You can combine style identifiers to be more specific:

TABLE#MasterLayout{}
TD.Header{}

and chain them together to create complex styles with simple style syntax:

TABLE#MasterLayout TD.Header{}

In this case, the "TD.Header" style will be different for TD tags with the "Header" class when they exist under a table with the "MasterLayout" ID.

-Peter
 
Old February 13th, 2006, 07:56 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

excellent, thank you both

www.crmpicco.co.uk
 
Old January 27th, 2018, 08:34 AM
Registered User
 
Join Date: Jan 2018
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the HTML document, you can give a particular id to an HTML element. For example, you have many <h2> on your page. You want to style one particular <h2> with red color when someone clicks a button on the page. This effect is achieved using JavaScript.
To get this effect, you have to give an ID to identify the particular <h2>. you can give an id like redheading.

You can call this particular <h2> in CSS and JavaScript, using this ID.

To do that you have to use the # symbol followed by the id name. This targets the <h2> with that ID.

Hope this answer helps.


Regards

Pavithra
Spidergems Softlabz - The Best Web Design Company in Chennai

Last edited by pavithraramesh; January 27th, 2018 at 08:35 AM.. Reason: formatting issue





Similar Threads
Thread Thread Starter Forum Replies Last Post
css and style atribute equivalents nerssi Javascript 2 April 11th, 2007 05:26 AM
assigning a css style sheet from an element miguel XSLT 7 August 8th, 2004 01:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.