473,386 Members | 1,610 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,386 software developers and data experts.

Classes in CSS and HTML. How exactly do you use them in the CSS document?

Ummm.... I forgot! How do you define a define a tag which you have given a specific class in HTML in the CSS document? So say your HTML looks something like this:
<p class="default">Somerandomtext</p>
So in this case how exactly do you formulate the CSS. Is it like this?
p.default {color:red;}
Mar 14 '13 #1

✓ answered by r035198x

p.default would select only <p> tags with that class. If you want to apply it to all elements that have class default then you would define the class as just

Expand|Select|Wrap|Line Numbers
  1. .default {
  2.      color:red;
  3. }

4 1559
Rabbit
12,516 Expert Mod 8TB
Yes, you can do that.
Mar 14 '13 #2
r035198x
13,262 8TB
p.default would select only <p> tags with that class. If you want to apply it to all elements that have class default then you would define the class as just

Expand|Select|Wrap|Line Numbers
  1. .default {
  2.      color:red;
  3. }
Mar 14 '13 #3
Thanks so much for the quick response! I was looking for a community where people share questions and knowledge, and I finally found it. I am 12 and started learning HTML and CSS when I was nine, now I am studying JavaScript and Python.
Mar 14 '13 #4
This is really great information which you have share. As HTML and CSS great platform to work on.
Mar 15 '13 #5

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

Similar topics

2
by: Andy Glew | last post by:
I have long looked for (and occasionally posted questions to groups such as this about) a tool that can take a group of HTML pages (nowadays XHTML, or XML) and produce a nicely formatted...
9
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
0
by: John Baker | last post by:
Hi: I am just scratching the surface of developing an Approach application that will take its input through the web using an HTML page. In tinkering about with the "Data Access" page...
0
by: mrbog | last post by:
Is it possible to write a C sharp app that can get the HTML that is currently being displayed in IE, including the html that was created by a javascript document.write()? Note: I'm not talking...
3
by: Epetruk | last post by:
Hi, I'm looking for samples of ASP.NET projects where the programming has been done almost entirely using codebehind and classes with very little code in the aspx files themselves. I would...
9
by: John Williams | last post by:
How do I load a HTML page (via URL) and parse the DOM in a Console Application? I've successfully done all this in a Windows Application by using the WebBrowser control, calling the Navigate...
15
by: Jake Barnes | last post by:
I'm trying to learn AJAX so tonight I sat down and came up with a little toy that I can do tests with. You can see it here: http://www.publicdomainsoftware.org/ajaxExperiment.htm I've got...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.