473,511 Members | 14,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confucion with Class & Id's

RamananKalirajan
608 Contributor
I am having some confusion with the class & Id. I browsed and got some info regarding the difference between Class & Id in CSS, Class can be used for many tags or elements in the page but Id can be used only once in a page. Instead of doing like that why cant we write the css as inline for that particular tag or element. If we use Id can we use that Id in Javascript, as what we do inorder to get the Element with Id. Please clarify me. I dont know I am correct or wrong.


Regards
Ramanan Kalirajan
Nov 5 '08 #1
3 1362
acoder
16,027 Recognized Expert Moderator MVP
Yes, you can use that ID to get the element by its ID using document.getElementById().

The ID can be useful not just for a particular element, but you could do something like this:
Expand|Select|Wrap|Line Numbers
  1. #someid p { ... }
so it would only be applied to p elements contained within the element with ID "someid". That's only a simple example, but you get the idea.
Nov 5 '08 #2
RamananKalirajan
608 Contributor
Yes, you can use that ID to get the element by its ID using document.getElementById().

The ID can be useful not just for a particular element, but you could do something like this:
Expand|Select|Wrap|Line Numbers
  1. #someid p { ... }
so it would only be applied to p elements contained within the element with ID "someid". That's only a simple example, but you get the idea.

Thanks sir, I can grasp some idea from the example what u had shown in the post

Regards
Ramanan Kalirajan
Nov 5 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Glad you could.
Nov 6 '08 #4

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

Similar topics

1
7805
by: Dan | last post by:
I wnat to see in browser an status from an device connected on rs232 port The java class for read from serial port is: //Serial.java import java.io.*; import java.util.*; import...
12
9420
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA...
3
2172
by: rockoyster | last post by:
Not sure if this is entirely a CSS issue but I have defined the class below in CSS. If I am stretching the friendship then I apologise in advance. I am trying to write a javascript script to...
12
6299
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: ...
2
3951
by: wael radwan | last post by:
how to customize the serialization of a collection that inherited form CollectionBase i.e making the class implementing ISerializable interface because when deserializing using the desrializing...
2
1619
by: Mehdi | last post by:
Hi, I need to pass an URL via a hidden value as follow: <input type="hidden" id="Test" runat="Server"> and on Page_Load I assign a value to this hidden input as follow: Test.Value =...
2
2041
by: freegnu | last post by:
how to declare a friend function that can access two class it will look like the following class A { private: int i; public: A(){} ~A(){} friend void call(A &a, B &b);
0
1675
by: Mudiya Dissa | last post by:
Hi, I have some code on my application like the following <% redirectUrl = "mypage.asp?type=100&id=something&view=10 'some more asp code
3
2187
by: Tony | last post by:
I see that many pages have &amp; in querystring instead &. What is difference? Can I put page link (url) www.mysite.com/mypage.aspx?lang=EN&ID=15 or I need to write...
0
7251
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
7148
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
7367
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
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
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,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.