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

User Defined ID - CSS

254 100+
i have this in my text book:
An ID is just like a class, but can only be applied ONCE in a document....
what does it means?

i have tested this on my mozilla browser, and it works fine. This code contain same ID and used TWICEly.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>ID example</title>
  4. <style type="text/css">
  5. <!--
  6. #title { color: red }
  7. h1#color { color: blue }
  8. -->
  9. </style>
  10. </head>
  11. <body>
  12. <h2 id="title">The use of the ID example</h2>
  13. <h1 id="color">Blue header but only conce</h1>
  14. <h1 id="color">BlaBlaBla</h1>
  15. </body>
  16. </html>
  17.  
So what does it means by "Can only be applied ONCE in a document?
Jan 30 '07 #1
3 1526
So what does it means by "Can only be applied ONCE in a document?
Just what it says. You should only use an ID to identify a single element. If you choose to break the standards your page will not be valid HTML and may not work in all browsers.

In order to apply a style to a number of elements you need to define a class, eg.

Expand|Select|Wrap|Line Numbers
  1. <style>
  2. .features {
  3.   border : solid 1px red;
  4.   color : #444;
  5.   font-weight : bold;
  6. }
  7. </style>
  8.  
and then in your code you can apply this class to any selected element eg.

Expand|Select|Wrap|Line Numbers
  1. <h1 class="features">test</h1>
  2. <p class="features">test</p>
  3.  
Jan 30 '07 #2
nickyeng
254 100+
that means code that i provided above might not works on all the browsers, and it is better define a CLASS instead of ID if i want to use number times of that element ?
Jan 31 '07 #3
That's right.
Jan 31 '07 #4

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

Similar topics

1
by: arabub | last post by:
I have an installation of Apache that apparently includes PHP (out of the box Redhat 9.0). If I make database calls to Postgresql, as what user is that call going to be made? The user that...
0
by: Shailesh | last post by:
Hello, I want to set up some USER DEFINED METRICS in 10g. The restriction with USER DEFINED METRICS, is the query (or function ) monitoring that metrics should return only 1 value. I want to...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
2
by: David Emme | last post by:
Access 97 I have a number of SELECT statements which contain references to user-defined VBA functions. These typically work as expected, but occasionally, on one user's machine or another,...
3
by: chreo | last post by:
I have user-defined function in MSSQL which returns Table (with 10 columns) (sorry for Polish names) CREATE FUNCTION PACZKI_Z_AKCJI (@AKCJA_ID int) RETURNS TABLE RETURN SELECT TOP 100...
1
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date format? Example, User Defined Date Format as...
17
by: Steve R. Hastings | last post by:
I have been studying Python recently, and I read a comment on one web page that said something like "the people using Python for heavy math really wish they could define their own operators". The...
3
by: Hallvard B Furuseth | last post by:
I'm wondering how to design this: An API to let a request/response LDAP server be configured so a user-defined Python module can handle and/or modify some or all incoming operations, and later...
0
by: tony | last post by:
Hello! For some month ago I created a project using template Window Control Library. From this template I created a user control(DLL) that I have in the toolbox and can drag it into a window...
2
by: jr | last post by:
Hello everyone! I am new to this sort of postings so I'm not even sure if this is the correct place to start. Anyway, I would realy appreciate any help. I have a some VBA code that works quite...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.