Nov 27

Newbie Web Developers Common Mistakes

Last week our company had a skill test exam for front-end web developer vacancy. I sneak peek a couple designs and I found out some bad habits in their codes.

Here are the coding habits you would like to avoid.

Use the right tag for appropriate function.

vertical category list

vertical category list

Here is a bad vertical category list source code.
Example 1

Comment: overkill div tags

<div> Shop by Categories</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

Example 2

Comment: dont use heading tags on your category list

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

Example 3

Comment: update your web development skills

<div class=”shopbycategories”><font class=”shopbycategoriesText”>Shop by Categories </font></div>

<div class=”greenleftBG”><font class=”businessmgtTEXT”>Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

</font><br>

Here is the correct way presenting your source code for vertical category list

Comment: your id=”category” will now take care of the styling

<div id=”category”>

<h2> Shop by Categories </h2>

<ul>

<li><a href=”#”> Business and Management</a></li>

<li><a href=”#”> Business and Management</a></li>

<li><a href=”#”> Business and Management</a></li>

</ul>

</div>

Remember you are coding for a vertical category “list” so you might as well use list tag and make use of li tags.

9 Responses to “Newbie Web Developers Common Mistakes”

  1. [...] bestwebbuzz.com Salva e condividi questo articolo: Queste icone linkano i siti di social bookmarking sui quali i [...]

  2. Jason says:

    I totally agree with using the proper elements for their intended function.

    But…

    For this example list why not use a ‘dl’?

    Use the ‘dt’ for the heading, and ‘dd’ for the list. By default the browser will bold the ‘dt’ and have a ‘list-style: none’ for the ‘dd’.

    By using the ‘dl’ you can also get ride of the extra div wrapper. And just give the ‘dl’ the id or class.

    Just my 2 cents.

  3. badik says:

    g spam lagi na niya iya divs og br tags doh?

  4. Paul says:

    I agree… better to use construction instead of that ugly h2! The title is symantically attached to the list.

  5. Paul says:

    oh it stripped out my tags haha.. again:

    I agree… better to use a ‘dl’ / ‘dt’ / ‘dd’-'ul’ construction instead of that ugly h2! The title is symantically attached to the list.

  6. [...] Newbie Web Developers Common Mistakes [...]

Leave a Reply

preload preload preload