HTML Experts: Is there is a special or secret way to use HTML while designing a webpage?
Printable View
HTML Experts: Is there is a special or secret way to use HTML while designing a webpage?
Hi there Malcolmjean,
and a warm welcome to these forums. ;)
Well, I start with a valid document...
...and methodically code from the top left to the bottom right.Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Untitled Document</title>
<style type="text/css">
</style>
<script type="text/javascript">
(function() {
'use strict';
function init(){}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
})();
</script>
</head>
<body>
<div>
</div>
</body>
</html>
At pertinent points in this process, I check the validity of the code here......and for cross-browser compatibility in my test browsers...
- Firefox 18.0
- IE 9
- Chrome 24.0
- Opera 12.12
- Safari 5.1.7
coothead
I use position: absolute; in the CSS for DIVs. The title is quite misleading, the position is actually relative to the containing DIV, and is very useful for sites that you want to adjust automatically to different screen sizes.
Also, I'd suggest that you still need to test your web pages on IE8. This is particularly so if you are coding in HTML5. IE8 does not understand the new bits in HTML5 so you need to ensure that the page degrades gracefully.
I think that all aspiring Web authors should at least start off coding Markup by hand - it is the only way to truly master the language. I also think that validating Markup and Style Sheet coding is very important for producing fully interoperable and standards compliant web pages.
The essentials:
Employ standards compliant HTML Markup
Use a Text Editor and Code Markup by hand
Use Strict Doctypes in order to preclude deprecated elements/attributes and avoid quirks mode serving
Use HTML in preference to XHTML
Check and correct Markup syntax constantly - use Tidy utility
Structure pages correctly - correct nesting and well-formed
Use Header elements (H1 -- H6) correctly for Creating Semantic Structure
Avoid using Tables for page Layout - If you must, check Accessible Tables for layout
Use UTF-8 character encoding
Include meaningful ALT text for all images - or explanatory adjacent text
Use W3C Markup Validation Service to insure correct function in all User-Agents
Use externally linked Style Sheets for page layout/presentation
Use W3C CSS Validation Service to insure correct page display and function.
Be prudent in the use of scripting languages - use them to manage content rather than for presentation effects. Keep in mind client-side scripting in particular slows down page loading.
Validation:
Validation enhances Interoperability -- correct rendering in all user agents. However, web pages can, and do, fail validation and still display pretty much as expected in graphical Browsers anyway due to their built-in Markup discrepancy compensation -- thereby relying on the often unreliable error correcting properties of individual graphical Browsers. Validation does catch many easily corrected Markup errors and the resultant code is consequently easy to maintain or change. Pages containing invalid Markup may not display or function correctly in Screen Readers, BRAILLE interpreters and Textual Browsers or when incorporated into other applications. As we move toward the Semantic Web, the rigors of XML will result in a greater requirement for Valid Markup. Valid and well formed Markup also bespeaks careful craftsmanship and that appeals to many web authors.
And .....
You Can't Get Every Page to Look Identical, So Stop Trying!
Remember that it is the quality and usefulness of the content and the ease of navigation through it that are of the greatest importance to most web page users.
James