*

Dear visitor! Welcome to Bad HTML. With this website we want to teach you the best web design practices to avoid Bad HTML. Find here everything you need to know to build the most user-friendly website ever!
Today is 2024 March 19, Tuesday
Subscribe To Our Daily Newsletter:
captcha
Play Music:
×
Raising Awareness For Bad HTML Practices
like social
facebook counter

Wrong Use Of HTML Tags

We have collected the most common HTML markup crimes that have to be avoided. Every time you publish a code like the list below a kitten dies. We recommend to always clean your HTML to make sure there's nothing wrong with your source!

Inline styles

Bad HTML tags inline styles

Try to avoid inline styles because they overwrite the default stylesheet of the website, breaking the design. You can use them for example to quickly set text-align: center for a paragraph but don't use these to style text. The purpose of semantic HTML and CSS is to separate document structure and styling, so let the CSS do the styling and use classes and predefined styles instead of inline styles!

Inline JavaScript Event Listeners

Inline JavaScript Event Listeners HTML tags

Just like inline styles, inline JavaScript doesn't belong to the HTML source and you should try to keep them separated. Our example can be implemented using jQuery in an included .js file using the short code below.

$( document ).ready(function() {    
			$( "#linkid" ).click(function() {
				dothings();
			});
		});
		

Inline Elements Containing Block Elements

Bad HTML tags Inline Elements Containing Block Elements

Every HTML element has a default display value depending on what type of element it is: block or inline.

Block elements by default begin in new line and take up the whole width of their container. Of course you can override this with CSS if you float it and/or assign a width to the element.
Examples: div, p, table, h1, form, ul, li

Inline elements flow along with text content, don't clear previous content to drop to the next line and only take up as much width as necessary. Ignore top and bottom margin settings, but will apply left and right margins, and any padding. They ignore the width and height properties as well unless they are set to display: block.
Examples: a, span, strong, em

Using Deprecated Tags

Bad HTML tags

We have dedicated a separate article on this website for Obsolete HTML Codes but it's important to raise awareness for this again and again.

Set Spaces

Set Spaces HTML tags margin padding nbsp

Unexperienced editors often use repeated spaces or empty lines to push the text down or right. Many times we can see in Microsoft Word a text being positioned using this method, which is a very bad practice. We should use margin or padding styles to set the gaps and to position the text as desired. 

Code Indentations

Bad HTML Code Indentations

Using code indentation is not a must but it's highly recommended, to make the tag hierarchy clearly visible. HTMLg online HTML Editor tool kit has a nice feature which sets the code indentation automatically. Paste your code in the source editor and press the tree icon in the toolbar and the program will organize the lines. Press it one more time and it will arrange the inline tags as well.

not supported

Install Ruwix 2024 to play plugin

not found
unfinished sidebar
Please check back later!
© 1992 - 2024 WWWEEEBBB | About | Contact | Terms & Conditions | This website is using cookies to spy on the visitors secrets and personal life.
Switch Design
Switch Design