Reputation: 35255
It's a subjective question but don't you think the following HTML syntax would make more sense?
<div #id .class1 .class2><!-- content --></div>
Instead of:
<div id="id" class="class1 class2"><!-- content --></div>
Upvotes: 2
Views: 2011
Reputation: 75707
You might enjoy using HAML (with any of these implementations):
%body
#header
%h1 BoBlog
%h2 Bob's Blog
Upvotes: 4
Reputation: 354596
Might be that it makes more sense to someone who authors only HTML and CSS. However, bear in mind that
I agree, for a very narrow purpose, it might be a beneficial change, but when viewing at this from a broader angle, I doubt you'll see much improvement, only pain. You can of course use a preprocessor to write your HTML this way and convert it to the actual thing.
You may also want to take a look at other languages who convert into HTML, such as Haml.
If you are content with just typing something similar to what you have proposed, then Zen-Coding might be an option for you. Quoting:
Zen Coding is an editor plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing. The core of this plugin is a powerful abbreviation engine which allows you to expand expressions—similar to CSS selectors—into HTML code. For example:
div#page>div.logo+ul#navigation>li*5>a
... can be expanded into:
<div id="page"> <div class="logo"></div> <ul id="navigation"> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> </ul> </div>
Upvotes: 10
Reputation: 16848
That might work for the example you provide, but how would you notate the following?
<a id="my-link" href="http://example.com" rel="external" target="_parent" class="complex" title="click here for no good reason">My Link</a>
HTML has specific attribute names so that you can work with key/value pairs (with the possible exception of boolean attributes such as checked
). If you take away the keys, the values become ambiguous and it is too hard to see what property should adopt which value.
Upvotes: 2
Reputation: 6441
Not really. Attributes in HTML are general, CSS only builds on top of them. HTML itself has no notion of "ids" or "classes", only attributes.
Upvotes: 4