I copied the exact HTML code from David's completed project index.html.
You may get browsers to display elements in spite of bad code. But the code in your first example was clearly wrong for many reasons starting with this chaotic mess:
<main id="hero">
<article>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } A:link { so-language: zxx } -->
<BODY DIR="LTR">
#1 The doctype declaration must appear on the very first line of your page. Only one doctype is allowed per page.
#2 <main id="hero"> is not a valid HTML tag. David's code contains <div id="hero">. A big difference. Also, David puts his <div> and <article> tags inside the <body> tag where they belong.
#3 embedded CSS code must be wrapped inside <style> tags. Besides your CSS doesn't make any sense so just remove it. Stick with the CSS code inside the external CSS file.
#4 <body dir="ltr"> Unless you're coding pages in middle eastern languages, you do not need to specify the direction of text. The default is left-to-right. So this is unnecessary code that should be reduced to just <body>.
#5 I highly recommend reviewing HTML & CSS fundamentals before you open DW again. It's required learning. And it will make working with DW much easier. Start with the links below:
- http://www.html.net/
- http://w3schools.com/
- http://www.csstutorial.net/
- http://phrogz.net/css/HowToDevelopWithCSS.html
Good luck!
Nancy O.