How to write a responsive semantic HTML5 page ? (With a framework ?) - css

So I'm trying to build a nice page for a blog, but the challenge is I want it to be the most proper HTML5 compliant and mobile/seo friendly.
I have made what I believe to be a proper HTML5 page that looks like this :
<!-- Header -->
<header>
<h1>Title of the page</h1>
<h2>Subtitle of the page</h2>
<!-- nav -->
<nav>
<ul>
<li>Page one</li>
<li>Page two 2</li>
<li>Page three 3</li>
<li>Page four 4</li>
</ul>
</nav>
</header>
<!-- last articles -->
<section>
<article>
<header>
<h2>Article title</h2>
</header>
Content of the article.
<aside>
Related post or other links.
</aside>
<footer>
Read the full article.
<ul>
<li>Share on Facebook</li>
<li>Tweet it</li>
</ul>
</footer>
</article>
<article>
<header>
<h2>Article title</h2>
</header>
Content of the article.
<aside>
Related post or other links.
</aside>
<footer>
Read the full article.
<ul>
<li>Share on Facebook</li>
<li>Tweet it</li>
</ul>
</footer>
</article>
</section>
<!-- sidebar -->
<aside>
<h2>Sidebar</h2>
<h3>Social media</h3>
<ul>
<li>Facebook account</li>
<li>Twitter account</li>
<li>Github account</li>
</ul>
<h3>Last comments</h3>
<nav>
<ul>
<li>Comment 1</li>
<li>Comment 2</li>
<li>Comment 3</li>
</ul>
</nav>
</aside>
<!-- footer -->
<footer>
© 1264-2016 - Handsome coder (me) industry
</footer>
I don't know about you but I think it looks like a proper semantic use of HTML5 tags.
Now I want it to be responsive and two options are presented.
I do all the css by myself (maybe using normalize.css to prevent weird stuff from happening on some browsers.)
I use a lightweight framework, for example Skeleton.
Both would mean the use of classes but also of probably the use of div tags to wrap certain parts of the pages and I'm not sure it is how I should do it...
I'm trying to avoid the over use of div tags, especially the nested div that look like ol' of ten years ago.
I tried to use the HTML5 Boilerplate, but I just looked at the source code of their main page which is quite simple in appearance and I found div in div in div in div in div. I mean, what the hell ?
So what do you think I should do to build responsive proper and semantic HTML5 pages ? Do you have any example ?
Thank you for reading me.
Have a nice day.

As far as I understood, you want a way to build simple, semantic, lightweight pages (which should be the aim of us all).
Adding / nesting divs is not a crime. A div by itself is just a blank container which holds very little relevance to the overall HTML document structure, you can use as much divs as you like. Focus on learning HTML/5 Semantics and learning how to combine the new tags so that your page can be easy to read and describe (by the bots).
Example of a well structured simple page. (Google images)
Concerning grid systems - My advice is to learn SASS and combine it with Bourbon.io's grid system called Neat. It is pretty straightforward and easy to understand/implement. The grid alignment is sorted in a super-simple manner which gets your code down to something like:

Related

Modifying css search-toolbar

I am trying to create a page with a search bar and filters underneath. I really like the way the search-toolbar looks, but it's creating space that I don't need. Is there a way to modify i to get rid of the space?
Thanks!
Here's an image of what I have:
Search bar with toolbar underneath
Edit: That grey space is what I'm trying to get rid of.
Here's my asp code:
<div class="search-toolbar" style="background-color:white">
<ul class="list-unstyled nav nav-pills">
<li>
Everything
</li>
<li>
Other Content
</li>
</ul>
</div>
<div class="tab-content">
Content
</div>
Figured it out, I found the css file and edited it.
I'm still new to web development, and I wasn't aware that I could do that.

Combining fixed HTML with Umbraco 7 Grid content

I'm new to umbraco, and I've encountered the following problem.
I have a design with a fixed navigation box on the left. The right side is for content. This content needs to be filled with the new grid-layout from umbraco.
But the grid-container keeps getting the full width of the site. So together with the navigation-box, it pushes outside my site.
Like this:
http://i.imgur.com/iEo4Os6.jpg
I've tried the following html:
<div class="row">
<div class="col-lg-2">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div class="col-lg-10">
#CurrentPage.GetGridHtml("ArticleContent")
</div>
</div>
But the GetGridHtml places a complete full width container inside my column. Setting the container to 10 columns (and the row configs too) within umbraco doesn't help either.
Anybody know a solution? Thanks in advance.
I think the solution could be to make your grid row configuration only span ten rows? I don't have enough rep in here (yet) to just comment, sorry.

Is it acceptable to use data attributes for layout?

Lately, I have been using data attributes for layout. For example:
<section data-ui-panels="vertical open" data-ui-accordion="stacked" class="primary new-products">
<ul data-area="nav" class="ui-list">
<li>Option 1</li>
<li>Option 2</li>
</ul>
<div data-area="body" class="journals">
<div class="unit">
<p>This is my text</p>
</div>
</div>
</section>
Benefits
Code is more readable: I can more easily spot the layout elements in both HTML and CSS. Options for the layout don't have to be verbose (e.g. stacked instead of ui-accordion-stacked).
Easier styling: The layout classes might get overridden by other classes. Attributes always take priority over classes, so then don't get overridden. Many of these layout attributes work with Jquery, so Jquery doesn't get overridden by anything else.
Easier re-usability: I can re-use the code between projects, without having to worry about site-specific code overriding the layout.
Works on older browsers such as IE8.
Are there any drawbacks to doing this?
I found this article that suggests there might be performance issues, but in the values it provides, the data-attributes perform quicker, so I don't quite understand it.

Kentico CSS List Menu styling

I am to implement this structure with kentico
<li class="megamenu_button">Mega Menu</li>
<li>Home</li>
<li class="aa">About Us<!-- Begin Item -->
<div class="dropdown_4columns dropdown_container"><!-- Begin Item Container -->
<div class="col_12">
<img class="img_left" src="images/about_us_img.png" width="125" height="146">
<ul class="list_unstyled">
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
</ul>
</div>
</div><!-- End Item Container -->
</li><!-- End Item -->
</ul><!-- End Mega Menu -->
The design is meant to have at least 6 menu headers with sub-menu each.
The challenge is I don't even know how to approach the design. I am currently using aspx master template. All suggestion is welcome.
Attached to this is an image of the expected production. I have the that suit the listing above.
You will need to make use of nested repeaters (CMSBasic Repeaters).
May you find below useful links on how to do it.
Option 1
Option 2

How to get a small div bar to slide down a menu on mouseover

I want a simple slide-down div-bar like on soundcloud, youtube, gmail
It is used in some really good websites with a menu dropdown, and I want to know how to do it using css or even jquery if needed. I can't post images yet, because i don't have enough reputaion yet... Here is the example on soundcloud
Check out this DEMO, it should help you for sure.
<nav id="main-nav">
<ul id="nav-primary">
<li>Menu 1
<ul class="subnav">
<li>beans
</li>
<li>pork chop
</li>
</ul>
</li>
</nav>
The css part is in the DEMO

Resources