Tag strong instead h2 at page? - html

I have list of services in main page with a short description:
<div class="services">
<div class="item"><h2>Service 1</h2>Description</div>
<div class="item"><h2>Service 2</h2>Description</div>
<div class="item"><h2>Service 3</h2>Description</div>
<div class="item"><h2>Service 4</h2>Description</div>
</div>
What is the best way for SEO? I need to use h2 or strong tag for names of services?

Use H2 if you want the crawler to index words in the node as key words for your site. Best to use as few H2s as possible and only one H1 on a single webpage.
Best use scenario example:
<div class="services">
<h2>Services Description</h2>
<div class="item"><h3>Service 1</h3><p>Description</p></div>
<div class="item"><h3>Service 2</h3><p>Description</p></div>
<div class="item"><h3>Service 3</h3><p>Description</p></div>
<div class="item"><h3>Service 4</h3><p>Description</p></div>
</div>
EDIT: You can see this in practice by putting one of your websites into Nibbler: http://nibbler.silktide.com/ - just be aware that you can only test three websites using the free version so don't waste your efforts putting in sites you didn't create :)

Related

Using custom tags to incase proper tags in HTML

After reading What are the implications of using custom tags in HTML? I have decided to not use custom tags the way I was planning to use them so that I follow standards, and bots may read my code properly. Although, I wanted to know if rather than using custom tags for divs, if incasing these divs within custom tags would still cause any negative effect to my source.
I wouldn't be using: <SomeDiv> rather than <div class="SomeDiv">
Something more along the lines of:
<header>
<nav>
<div class="navWrap">
<div class="navGutz">
NAVBAR
</div>
</div>
</nav>
<logo>
<div class="logo">
LOGO
</div>
</logo>
</header>
<content>
<left>
<div class="myContent">
<topContent>
Main content and more divs
</topContent>
</div>
</left>
<right>
<div class="sidebar">
<news>
News
</news>
</div>
</right>
</content>
<footer>
<div class="social">
Social Links
</div>
<div class="copyright">
Copyright
</div>
</footer>
I ask because rather than using comments to label sections, I wanted to use tags. That way if for any reason I wanted to add style to the section in a whole, I would be able. Visually looking at it it seems a little redundant, but there would be more to it rather than what is just in the example.
So to restate the question, would incasing my content (that is up to standards) with custom tags cause any sort of negative effects against my site? Whether it be indexing, crawling, score, etc.
You should check this article on DEV. The article is about Custom HTML tags, Web Components, the Custom Elements spec and the few js libs.

Bootstrap, <body class="container"> [duplicate]

I keep bumping into this issue where everyone keeps:
a) wanting to wrap HTML5 semantic tags with divs, and
b) wants to apply class selectors to the divs and not the semantic tags. It's as if people are afraid of slapping classes onto semantic tags for some reason.
For example, I am constantly told that this is "incorrect",
<body class="container">
<header class="row">
<div class="col-md-12"> ...
And something like this is more preferable,
<body>
<div class="container">
<div class="row">
<div class="col-md-12"> ...
And here, where the first example I have the column class in the h2 tag
<div class="row">
<h2 class="col-4 feature">Featured Work</h2>
</div>
But "the correct" way is to add yet another div tag to apply the class,
<div class="row">
<div class="col-4 feature">
<h2>Featured Work</h2>
</div>
</div>
I understand that this might be opinion-based, but I have found that when dealing with HTML5, opinions actually matter since virtually everyone is having issues and there is no other way to hammer out the details without opinions.
I recommend sticking to the
<body>
<div class="container">
<div class="row">
<div class="col-md-12"> ...
format.
If you intend to work with a lot other developers or with bootstrap templates- you will see that the container classes typically nest row class divs.
Since we are talking about markup there is no right answer, but following this convention is strongly recommended.
For consistency
For easy changes to styling & reusability with other projects- this even opens the door to drop-in replacements of css stylesheets from other projects or bootstrap templates. (I have had some surprisingly good results with this).
However, if you insist on giving non-div tags "container" and "col-X" tags, be consistent. I wouldn't recommend it though and would consider any template that follows its own convention to be an indicator of poor code quality.

BEM Methodology proper HTML structure

I have a doubts about this HTML structure. Is it correct according to BEM approach?
<div class="boxWithBorder">
<div class="header">
<h2 class="boxWithBorder__element"></h2>
</div>
</div>
To my mind it should look like that
<div class="boxWithBorder">
<div class="header">
<h2 class="header__element"></h2>
</div>
</div>
What keeps elements encapsulated.
Generally we do components and structures, that means structures are compositions of components. It will require nesting so that part is ok. As far as your first approach that is not ok by our standards and not used. block1 should not live inside block2 but block2 has to live inside block1 as it's a nested component. Makes sense? BTW BEM is perfectly fine to use and a lot of frontend devs do it, heavyweights as well, check out csswizardry.com for instance, he got some great articles about BEM
Also I would suggest the following using BEM (or any html/css for that matter) is that skip the camleCase and use "-" instead
<div class="box-with-border">
<div class="header">
<h2 class="header__element"></h2>
</div>
</div>
<div class="hero hero--red-with-border">
<h1 class="hero__title>Title...</h1>
<p class="hero__body-text">Text...</p>
</div>

HTML5 semantics - h1 usage in a product lister

We're having a discussion on the usage of h1 tags in a product lister page. There are several facets that can be used to filter the products.
Technical wise it's OK to use multiple h1 tags if they are wrapped in a section or article. But we're in a discussion if it's also useful to use h1's in a lister were we only have a title, packshot and price. It seems to us that it's not a good idea to choose h1's while (SEO-wise) meaningful content is missing.
Below is the markup of 1 product. With no facets selected, we list 100+ products (with lazy loading).
<div class="productItem--vView productItem" data-webid="productLister-item">
<article>
<a class="wrap" href="/products/category">
<header>
<h1><span>product x</span></h1>
<div class="meta">
<div class="spec price price--new">
<div class="value">
<span class="currency">€</span> 10<span class="decimal">.00</span>
<span class="type">new</span>
</div>
</div>
</div>
</header>
<figure>
<div class="image">
<div class="graphic">
<img src='https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=230&h=300'/>
</div>
</div>
</figure>
</a>
</article>
</div>
Is it correct to use h1's here, and what would be the best alternative here. h2?
If you want to use a sectioning content element (like article), it’s a good idea to provide a heading element. If you want to follow the advice in W3C’s HTML5, you should use heading elements of the appropriate rank (probably to support user-agents that don’t support the outline algorithm), instead of using h1 all the time (but h1 is allowed, too, and semantically equivalent).
However, in your case you might not need a sectioning content element, as you only have a title/link, an image, and a price. Creating 100+ entries in the document outline doesn’t seem to be appropriate for such "small" content. You could use a ul and place each product in a li, or maybe you could use a figure for each product.

Is it a bad practice to use divs for styling purposes?

I've seen lately a lot of discussions about this new concept called oocss and I was wondering if it is a bad practice to wrap your main tags in divs only for styling/page layout purposes.
I'm asking this because I see some frameworks like Twitter Bootstrap use such a method.
What are the implications of such a markup from a semantic and accessibility point of view?
For example:
<div class="container">
<div class="row">
<div class="span4">
<nav class="nav">...</nav>
</div>
<div class="span8">
...
</div>
</div>
</div>
instead of
<div class="menu">
<nav class="nav">...</nav>
...
</div>
No, it's fine. HTML is a "mark-up language", and mark-up involves styling. Besides, everyone does it. Many of the fluid multi-column layouts rest precisely on this approach.
Using unnecessary divs is not a good idea... if the HTML codes in the second box is enough to do everything that you want or need to do then don't use extra divs... secondly, HTML codes in the second box is much clear and shorter then the codes in the first box... if you keep your codes clean, short and formatted, it will help you a lot when you want or need to update your code in future...