Let suppose i have two html pages p1 & p2 and it uses different layouts l1 & l2 respectively. I have to design the two different layouts and i only want to use common ID names. I just tried to let you understand that what i have in my mind, pls conisder js fn too (id does matter when we use js).
commonPage.css
p1 > l1 > #right { width:25%; height:25% .... }
> #left { width:25%; height:25% .... }
p2 > l2 > #right { width:30%; height:35% .... }
> #left { width:30%; height:35% .... }
follwing are html pages :
p1.html
<html> <head> <link rel="stylesheet" href="commonPage.css" type="text/css"/>
</head> <body>
<div id = "l1.right"></div> <div id= "l1.left"></div> </body></html>
p2.html
<html> <head> <link rel="stylesheet" href="commonPage.css" type="text/css"/>
</head> <body>
<div id = "l2.right"></div> <div id= "l2.left"></div> </body></html>
@Edit My Question is : how to write same Id names for many html tags with different properties and it should not affect to each other.
You can’t identify HTML elements in a page by the page’s file name, so you have to either put the unique styles in
styletags in each page, or use IDs/classes for each page.In p1.html, give your
bodyelement an ID ofp1, name itp2in p2.html, name both of yourdivsrightandleftrespectively, so your HTML looks like this (showing onlybodycontents):p1.html
p2.html
Then use these selectors: