Standards: attribute order in HTML [closed] - html

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been working on updating the coding standards for my web development organization. One aspect of this that has proven contentious among my co-workers is the ordering of HTML attributes. One co-worker, and many sources I have found online, suggest that class or id should come first, followed by others in order of importance.
<a class="foo" href="/bar/baz.html">Link</a>
Supposedly, this aids in readability. I'm not so sure in this case. Sometimes, when people say something is more readable, what they mean is that they have become accustomed to a certain pattern, and can't browse as easily without the pattern. Which is really more subjective than readability. Another co-worker suggests (and I happen to agree with him) that the defining attribute of the element should come first, and then any presentational or organizational attributes should follow. The essence of the anchor tag is the href attribute.
Link
This might be trivial on an anchor tag, so what about an input tag?
When scrolling through a form, I want to know right away what the input's type is: text, radio, button, etc. Class can come later.
How do the rest of you feel about this topic? I'm interested in hearing any arguments for both sides. Maybe we shouldn't even be worrying about this particular bit of syntax?

Technically, it doesn't matter at all. In terms of personal preferences, all that matters are the personal preferences of those on your team.
My personal preference is that this is minutia and overhead that no one really should be dwelling on.

Related

Generic Presentation Block vs Generic Structural Block [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I generally think generally think of div as a generic structural block, and my mental designation for a generic presentational block is different. In practice I use <div class='flair'></div> with a media query to hide most 'flair' on small screens. My use of the flair class seems more suited to its own tag (as opposed to a class), but there's nothing in the HTML element reference that fits this description, and the HTML spec in general seems to be moving away from presentational tags. I'm wondering if other people have considered a tag like this, or if the fact that I'm asking this question at all implies that I think of HTML elements differently than most.
For clarity, I think of a 'generic presentational block' as one that meets most of this criteria:
is not required to understand the content of the page
contains no text, anchors, buttons
is not flow content
So, I have some questions:
Do other people use a specific class to denote generic presentational blocks?
Do you feel like an existence of such a tag would improve the HTML that most developers write? (context: I generally consider div soup to be a negative)
How would you feel about browsers having a builtin feature that disables this tag. This feature would be a superset of tools like adblock and noscript
Regardless of whether the question is relevant or not - I understand what you mean about "div soup," but since your flairs are semantically meaningless I think it's technically fine.
I work with a developer who uses the <i> tag with a role="presentation" attribute added. Honestly, I haven't really looked into the use of <i> but using role="presentation" for accessibility purposes may be something to look into if you haven't already? And can be used to hide presentational flairs on mobile.
https://w3c.github.io/aria-in-html/#presentation

Current usefulness of semantically correct HTML [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm working on a new website, and I'm trying to decide how I want to balance the need for semantic correctness, with other important stuff, like development time. I know that semantics are supposed to be important for SEO, and accessibility for blind people. And those are important to me, and shouldn't take too much extra time. So I'll design them in, from the beginning. Anyway, my question is, what else is semantic correctness currently useful for? If there's something else I may consider worthwhile, I'd rather spend a little extra time now to build it in, than wait until later, when it may be more difficult.
Also, I know there are a lot of future possibilities. Some good, and some not (I've seen all the Terminator movies:). But I'll wait and see what happens with those.
edit: I should have mentioned that supporting some old browsers is important for this project, so being semantically correct won't be easy. Especially since I haven't done a lot of browser programming.
I did some more research, so now I can answer my own question.
Other than making sure my site is accessible to disabled people and search engines, there isn't currently anything all that important about semantic correctness, for my project. And I think search engines and screen readers are sophisticated enough these days, to handle some incorrect semantics, as long as the content structure isn't too confusing.
I can see semantic HTML elements being useful for documentation though, as long as it doesn't complicate my code.

What is a semantically correct HTML element for a "statusbar"? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am writing a simple webapp and I need a status bar. Something that updates often to reflect what JavaScript is doing. It will only contain text, short complete sentences, but in the future it might have small informational images. Like, "An error occured" or "Please wait, loading..." or "Player 2 has disconnected". Now, I know how to make one, but my question is:
What is the most semantically correct HTML element to use for this?
Or will I have to resort to a <div> or <span>? If so, which one? I generally avoid those because they seem like a last resort.
Also, the statusbar may be anywhere on the page. Don't base your answer on its location on the page, that's not what semantics is about.
Please support your answer with some sort of official resource (w3, anything) if you can.
Being unable to find any source of information, I'll answer all by myself and defend my position. My answer is: it depends. The direct answer to your question is that there's no element specific for the status.
However, when this happen the solution normally chosen is to use a generic element as <div> or <span> and assign it some semantics. This can be achieved with class and id, as you are well aware. We cannot expect html to be perfectly semantic and cover every case possible. They are trying their best to cover the most common uses.
A very similar case is the <nav>. It was really common to see <div class = "nav"> or similar code in old html. w3 realized of this and changed it to make it more semantic. Maybe/hopefully they'll do the same for all those class = "status" for a <status>, it just hasn't happened yet.
For solving your problem right now: I'd recommend using a <p class = "status"> actually if your code is going to contain only a paragraph, as it seems. It's slightly more semantic than <div> and <span>.

What is the benefit of semantic tags? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm following a tutorial series on web development. While I already have a basic understanding of HTML and how to use it to structure a page, I'm indulging myself and watching the very beginner tutorials. The funny thing is, in these tutorials the author is using tags like address and cite. When he describes why one should use these tags, he explains it only as "semtantics."
While I feel like these tags may have been more prevalent ten years ago, I never run across anyone using them besides this guy. Given he is professional, I'm now conflicted on whether or not its really necessary to use them. What is the benefit?
According to the current HTML5.1 specification nightly (as modern as it gets):
The address element is valid perfectly fine to use and so is the cite element. While a lot of sites tend to mostly use tags like div and span you can feel safe to use both address and cite .
I think it's good practice that will help you later when you have to read your HTML again to insert changes. It improves accessibility of your document as well as lets parsers other than browsers understand it better.
(Note, address and cite are legal in the old HTML specification too)
The benefit of semantic tags is that they give your html some structure - by using them you are encoding meaning into your html that can be useful in all kinds of areas. Search engines often use semantic tags to assist in ranking pages, to use a simple example. Whilst it might not always seem necessary, it is good to get into the habit of using them wherever possible.

Are you familiar with <ins> tag in html? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I just found that google uses this tag for adsense,
but seems it also works without this tag,why they prefer to use it?
The <ins> tag is used to indicate content that is inserted into a page and indicates changes to a document. According to the HTML spec this was intended primarily for use in marking up versioning of a document.
Clients that aware of this tag may choose to display content inside this tag differently or not at all depending on what they are designed to do. This is very much semantic HTML
As for why Google decide to use it I couldn't say
INS is semantic tag describing something that is inserted to the text after the text was already published. It is not a big deal, it is I guess used by their robots to understand something they care about.
Adding semantics to markup allows tools to extract more meta data from them. Google is in the business of writing such tools, so has good reason to encourage the use of code that they can use.