473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Newbie Question about 'Style' Names

I've been using CSS for a while now but am now worried that I'm not 'naming' things (classes/id's) correctly.

What is the difference between:

p.class1 and .class1 .... when defined in a style sheet?

OR

p#id1 and #id1 .... when defined in a style sheet?

In the 'class' example above .... when I define p.class1 does it mean I can only use class="class1" in a <p> tag? (ie <p class="class1"> ... instaed of something like <div class="class1" )

Same question for #id1.

(sorry if duplicate question ...did a search but after first 5 pages of results got tired - and frustrated)
Aug 11 '06 #1
2 1355
Banfa
9,065 Expert Mod 8TB
In the 'class' example above .... when I define p.class1 does it mean I can only use class="class1" in a <p> tag? (ie <p class="class1"> ... instaed of something like <div class="class1" )
Basically yes.

p.class1 {
color: red;
}

<p class="class1">
</p>

<div class="class1">
</div>

only the text in the p will be red.

same for ids
Aug 11 '06 #2
TY for the quick answer. LEARNING
Aug 11 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
2
by: Kari Laitinen | last post by:
During the past 15 years I have been writing computer programs with so-called natural names, which means that the names (identifiers, symbols) in progarms are constructed of several natural words....
1
by: Andrew Poulos | last post by:
If I have this in the HEAD of a page: <style type="text/css">@import url(scripts/foo.css);</style> can can I get the name of the CSS file (in this case its "foo")? Andrew Poulos
5
by: Randall | last post by:
I am a newbie trying to learn the DOM. Can someone tell me why the first alert statement returns null, and the second returns the value 33px (which was set using the style="top:33px;" in the DIV...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
10
by: mcl | last post by:
Why can I not the change the value of a variable in another class, when I have passed it via a parameter list. I am sure I am being stupid, but I thought passed objects were Read/ Write eg...
5
by: Dave | last post by:
I am new to Visual Web Developer 2005 Expres. I am using absolute positioning and every time I add a button control to my web form its width extends all the way to the edge of the page. IOW I...
33
by: Adam Chapman | last post by:
Hi, Im trying to migrate from programming in Matlab over to C. Im trying to make a simple function to multiply one matrix by the other. I've realised that C can't determine the size of a 2d...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.