HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
HTML Tutorial

CSS Tutorial
11 - ID
2 - IDCATEGORY

What is the difference between id and class in html css


I want to know what is the difference between id and class in html and css if it is any.
I read somewhere that id's are unique and there can be only one element with corresponding id, and classes can be applied to many elements.
But I think this is wrong I have a code in which I have applied a single id to two elements.
<p>&lt;!DOCTYPE html&gt;<br /> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br /> &lt;head&gt;<br /> &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br /> &lt;title&gt;difference between id and class in html css&lt;/title&gt;<br /> &lt;/head&gt;</p> <p>&lt;body id=&quot;top&quot;&gt;<br /> &lt;p id=&quot;top1&quot;&gt;difference between id and class in html css&lt;/p&gt;<br /> &lt;p id=&quot;top1&quot;&gt;Hello World where is the difference&lt;/p&gt;</p> <p>&lt;/body&gt;<br /> &lt;/html&gt;</p> here is my CSS<br/>
#top1{ <br/> background-color:green;<br/> width:400px;;<br/> height:200px;<br/> margin-left:20px;<br/> margin-right:25px;<br/> text-align:center; <br/> font-size:18px; <br/> }
What is the difference between id and class in html css

11 2 - Name: what is the difference between id and class in html css
I want to know what is the difference between id and class in html and css if it is any.
I read somewhere that id's are unique and there can be only one element with corresponding id, and classes can be applied to many elements.
But I think this is wrong I have a code in which I have applied a single id to two elements.
<p>&lt;!DOCTYPE html&gt;<br /> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br /> &lt;head&gt;<br /> &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br /> &lt;title&gt;difference between id and class in html css&lt;/title&gt;<br /> &lt;/head&gt;</p> <p>&lt;body id=&quot;top&quot;&gt;<br /> &lt;p id=&quot;top1&quot;&gt;difference between id and class in html css&lt;/p&gt;<br /> &lt;p id=&quot;top1&quot;&gt;Hello World where is the difference&lt;/p&gt;</p> <p>&lt;/body&gt;<br /> &lt;/html&gt;</p> here is my CSS<br/>
#top1{ <br/> background-color:green;<br/> width:400px;;<br/> height:200px;<br/> margin-left:20px;<br/> margin-right:25px;<br/> text-align:center; <br/> font-size:18px; <br/> }





85 - - how to create a website responsive from scratch in bootstrap
Please, I want to know how to create a website responsive from scratch in bootstrap step by step and if possib...


80 - - how to make coffee with an espresso machine
Please, I want to know a recipe how to make coffee with an espresso machine best way and tasty.
I sea...


55 - - how to lose fat fast and gain muscle diet
Please, some ideas how to lose fat fast and gain muscle - diet plan. If you know some websites that describe d...


32 - - how to make cake pops recipe
Can anybody give me a simple recipe and easy for cake pops with as much detail as possible....


69 - - how to make slime at home less sticky
Please, I want to know a recipe to make slime at home less sticky.
I searched on internet, followed th...


70 - - how to make slime at home with shampoo
Please, I want to know a recipe how to make slime at home with shampoo.
I searched on internet, follow...


48 - - food near me open now delivery
How can I find restaurants near me with delivery? How can I find food near my open now with delivery? You have...


26 - - how to make money as a student
Many websites show how to make money as a student, but, we have not found anything concrete.
Can anyone...


38 - - how to make cake from scratch width and without butter cream
Please, I want to know a recipe for how to make cake from scratch width and without butter cream simple and wi...


71 - - how to make slime with soap and water
Please, I want to know a recipe how to make slime with soap and water.
I searched on internet, followe...


Minimum length is 2
Your add here
HTML Text Color
HTML Text Color
HTML Table Color
HTML Table Rowspan and Colspan
HTML Table Width
HTML Table Style
HTML Table Border
HTML Table
HTML Font Face
HTML Font Size
HTML Font Color
Learn PHP online from the basic to the advanced
HTML Headings, examples
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL BETWEEN Operator