Reputation: 611
I've viewed in some source code and found something like this:
<div class="classname {height: 300px; width: 200px}"></div>
I know that element styling is available by using the style=""
attribute.
Can you please tell me what this code means?
Upvotes: 2
Views: 119
Reputation: 1038800
It means nothing per se in the HTML specification. The website you were looking at was probably using some javascript code which interprets this class
attribute and performs some actions based on the values it has parsed. Without javascript this does nothing. In HTML the class
attribute is used to specify a CSS classname to be associated to this element.
For example the jQuery.validate plugin uses similar technique allowing you to specify inline validation rules. Actually the plugin uses data-*
attributes instead of class
which is semantically more correct for those kind of tasks.
Upvotes: 6