According to this : CSS Performance between class and attribute selectors, I am wondering which would be the best way to quickly manage HTML display rendering with style rules.
By "best way", I mean the most readable/beautiful/acceptable.
Here is an example : I would like a <div>
element to display like a table in an absolute position at x:25% and y:0.
To do this, I am more and more bored of defining class or id rules like this :
<div class="sthg"></div>
<style>
.sthg {
position : absolute ;
left : 25% ;
top : 0 ;
display : table ;
}
</style>
Even if classes allow to have groups of elements to stylize, this way looks too much specific for layouting our HTML.
And I wondered which way would be the "smartest" between those :
Using default HTML/CSS (as seen previously)
Using generic classes :
<div class="table abs x1-4 y0"></div>
Using generic attributes :
<div tabled abs x="1/4" y="0"></div>
Using new defined tags with generic attributes :
<tabled abs x="1/4" y="0"></tabled>
To read : Is there a way to create your own html tag in HTML5?
I know this looks tricky, but the goal to this would be to give more information in the HTML and lighten the CSS. Thus you won't need to read the CSS to understand how are positioned elements. HTML must be for managing layouts, and CSS for managing styles.
Here is a concrete example :
<body abs full>
<tabled abs x="1/10" y="1/4" w="128" h="128"><cell>
<div inline w="64">This is centered content with generic CSS.</div>
</cell></tabled>
</body>