5 Common HTML Mistakes you should avoid
1. Semantic Header and Footer
Divs have no semantic structure. Instead of using divs to create headers or footer structures, use “header” and “footer” elements.
Don’t do this
<div id="header"> ... </div> <div id="footer"> ... </div>
Do this
<header> ... </header> <footer> ... </footer>
2. Use Figure Element
If you need to add a caption to your image, use the “figure” element combined with the “figcaption” element.
Don’t do this
<img src="image url" alt="image description" /> <p> Lorem Ipsum Description </p>
Do this
<figure> <img src="image url" alt="image description" /> <figcaption> <p> Lorem Ipsum Description </p> </figcaption> </figure>
3. Don’t use bold or italic tags
The “b” and “i” tags are presentational tags, and have no semantic meaning, instead either change the font-weight/font-style in the CSS or use the “strong” or “em” element.
Don’t do this
<b>Bold</b> <i>Italics</i>
Do this
<strong>Bold</strong> <em>Italics</em>
4. Using descriptive links
A link’s text should be explicit and convey where is redirecting the user to, both users and search engines can more easily understand your content and how it relates to other pages.
Don’t do this
<a href="url"> Check our pricing... </a>
Do this
Check our <a href="url"> pricing </a>
5. Using inline styles
Writing inline styles violates the principle of having the structure (HTML) separate from the presentation (CSS). Instead write the styles in a stylesheet.
Don’t do this
<h1 style="font-size: 24"> Header </h1>
Do this
h1 { font-size: 24 }
- Previous:How To Get Selected Checkbox List Value In Jquery
- Next:
Related Questions
- 2021-09-28 How To Get Selected Checkbox List Value In Jquery
- 2021-09-26 What is CSS?
- 2021-09-16 How the browser displays the default style of table data
- 2021-09-15 What is the role of the list-style-image attribute?
- 2021-09-07 What are the advantages of Div+CSS layout?
Your opinion
- Hot Ranking
-
- How to upgrade from Windows 10 to Windows 11 for free
- How to avoid duplicate form page submissions
- How to pass PHP variables to JavaScript in WordPress
- What is a weakly typed programming language
- Difference between line break markers and paragraph markers
- What is window.postMessage in HTML5?
- How to implement browser forward and backward functions for web form buttons
- The table layout is suddenly very confusing
- How To Determine Whether PHP Is Good for My Website or WordPress?
- What is a scripting language
- The role of the unordered list ul tag
- The impact of automatic caching on dynamic pages
- What is an XML document declaration?
- What values can be used for the background-position property?
- What is the difference between fixed and absolute?
- Latest Answer
-
-
How to avoid duplicate form page submissions
binary options system strategy page Answer 2022-04-01 03:42:00
-
How To Determine Whether PHP Is Good for My Website or WordPress?
แอพเปลี่ยนรูปเป็นภาพวาด Answer 2022-03-27 18:27:12
-
The impact of automatic caching on dynamic pages
50 deposit binary options Answer 2022-03-24 05:31:20
-
How to avoid duplicate form page submissions
free binary options signals providers of goods Answer 2022-03-20 12:29:02
-
How to avoid duplicate form page submissions
binary options strategy 5 minutes 15 min no loss acord Answer 2022-03-20 09:44:29
-