semantic-markup

Is it fine to use span elements in div elements?

心不动则不痛 提交于 2019-11-28 14:02:19
问题 I am making a website with personal articles. The body of my articles is a basic div containing paragraphs, but recently I found it useful to use some span 's out of the paragraphs to manage my content as desired, hence in the div 's. As the web semantic becomes an important role and becomes more and more well constrained, I was curious of the downsides of such a practice. I am not too familiar with the standards of HTML yet. However, I was thinking using span 's in div 's is semantically not

Shall I use <section> tags inside <aside>?

情到浓时终转凉″ 提交于 2019-11-28 13:38:56
Having a markup like this: <aside> <div class="widget"> <h2>Latest news</h2> <ul>...</ul> <a>more news</a> </div> <div class="widget"> <h2>Choose site theme</h2> <input type="select" /> </div> <div class="widget"> <h2>Newsletter subscription</h2> <form>...</form> </div> <div class="widget"> <h2>Related articles</h2> <ul>...</ul> </div> </aside> Which tag is more appropriate here: <div> or <section> ? Is section supposed to be used only inside <article> tag and never inside <aside> ? The HTML 5 spec does not prohibit you from using the section element inside of an aside element. The aside

Can I style numbering an ordered list that has a start attribute value?

泄露秘密 提交于 2019-11-28 08:12:40
问题 Here's the problem: I have an ol li ordered list with a start attribute like so: .custom { margin: 0; padding: 0; list-style-type: none; } .custom li { counter-increment: step-counter; margin-bottom: 10px; } .custom li::before { content: counter(step-counter); margin-right: 5px; font-size: 80%; background-color: rgb(0,200,200); color: white; font-weight: bold; padding: 3px 8px; border-radius: 3px; } <ol start="6" class="custom"> <li>This is the sixth item</li> <li>This is the seventh item</li

Using section element for stylistic layout and wrappers

随声附和 提交于 2019-11-28 04:08:45
问题 I often use divs for stylistic layouts(pieces of markup with no content, specifically focused on the design) and wrappers on sites. With that said, Why should sections not be used for this task? Does a section by itself have an inherent semantic meaning that discourages it being used for wrappers? Almost every page I use has some wrapper or stylistic layout of some sort. Wanting to phase out divs, I wonder, if sections can be used for wrappers and still be semantically correct. 回答1: Yes, the

Most common way of writing a HTML table with vertical headers?

橙三吉。 提交于 2019-11-28 03:25:55
Hi all it's been a while since I've asked something, this is something that has been bothering me for a while, the question itself is in the title: What's your preferred way of writing HTML tables that have vertical headers? By vertical header I mean that the table has the header ( <th> ) tag on the left side (generally) Header 1 data data data Header 2 data data data Header 3 data data data They look like this, so far I've come up with two options First Option <table id="vertical-1"> <caption>First Way</caption> <tr> <th>Header 1</th> <td>data</td><td>data</td><td>data</td> </tr> <tr> <th

List or longer code snippet inside paragraph

馋奶兔 提交于 2019-11-28 02:19:24
When writing about algorithms, it is often very convenient to write some (pseudo)code inside a paragraph, or even in the middle of a sentence . To visually support the structure of a more complex sentence, lists come handy too. Obviously, one sentence must not be split across different paragraphs. But in our case it has to be due to HTML nesting rules. Paragraph is the p element , which cannot contain block-level elements . Unfortunately for our case, pre and lists are block-level . If I do not obey the spec and include pre or ol / ul / dl in a p , the p is automatically closed right before

Schema.org: How to extend a Class or Type

亡梦爱人 提交于 2019-11-28 02:14:20
I have to model a product, which has properties that aren't listed in the Schema.org Product type. After seeking in many places, I didn't find anything that fits to my need. How can I extend the Schema.org Product type? You could always use other vocabularies (that offer the properties you need) in addition to Schema.org. But if you want to use only the vocabulary Schema.org, you have two options in general: Propose new properties (or classes). You can do this on Schema.org W3C Community Group ’s mailing list , or on Schema.org’s GitHub issue tracker . See: How can I get involved? How can I

Is an HTML5 <header> tag unnecessary if there is only a single <hx> tag inside it? [closed]

佐手、 提交于 2019-11-28 02:13:14
I've searched and have not come up with any useful answers, so here goes: Is an HTML5 <header> tag unnecessary if there is only a single <hx> tag inside it? For instance, I have the following HTML5 markup: <article> <header> <h1>Heading Title</h1> </header> ... </article> From an HTML5 semantics point of view, when there is only one <hx> tag inside the <header> and nothing else, is the <header> tag unnecessary/redundant, and should I just do this instead: <article> <h1>Heading Title</h1> ... </article> simmer From the first Note section on the W3C's header spec which ajp15243 mentioned above,

Is there a standard method for naming classes? [closed]

二次信任 提交于 2019-11-28 01:12:40
For example: class="profile profile-image profile-image-large" OR class="profile profile-image profile-image-small" Is there something wrong with these names or dashes? To be perfectly honest, this comes down to individual developers and their own feelings. There are two equally good ways of structuring CSS classes, just like you suggested: .profile.image.large{ width: 300px; } /* Or: */ .profile-image-large{ width:300px; } They achieve the same thing, but when you start thinking broadly, you see just how wide the gap between these styles becomes. Separating classes makes them re-usable: The

Why does the HTML5 header element require a h tag?

女生的网名这么多〃 提交于 2019-11-28 01:04:12
According to HTML5Doctor.com and other HTML5 introductory sites, the header element should contain a h1-h6 tag plus other navigational or introductory content. However, the traditional 'header' on most websites consists of just a logo and some navigational elements. A lot of major sites including Facebook and Twitter use a h1 tag for their logo, which seems illogical to me, since the logo is not the most important or most informative element on the page. A h1 tag appears in the content section of 95% of websites, not the header section. So why are we instructed to include a h tag in the header