HTML5入门4---HTML5 与 HTML4 同一网页的不同写法
HTML4写法
css:
body { font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, sans-serif; max-width: 800px; } .Header { background-color: #7695FE; border: thin #336699 solid; padding: 10px; margin: 10px; text-align: center; } .Header h1 { margin: 0px; color: white; font-size: xx-large; } .Header .Teaser { margin: 0px; font-weight: bold; } .Header .Byline { font-style: italic; font-size: small; margin: 0px; } .Content { font-size: medium; font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif; padding-top: 20px; padding-bottom: 5px; padding-left: 50px; padding-right: 50px; line-height: 120%; } .Content .LeadIn { font-weight: bold; font-size: large; font-variant: small-caps; } .Content h2 { color: #24486C; margin-bottom: 2px; font-size: medium; } .Content p { margin-top: 0px; } .Footer { text-align: center; font-size: x-small; } .Footer .Disclaimer { font-style: italic; } .Footer p { margin: 3px; }
html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Apocalypse Now</title> <link rel="stylesheet" href="ApocalypsePage_Original.css"> </head> <body> <div class="Header"> <h1>How the World Could End</h1> <p class="Teaser">Scenarios that spell the end of life as we know</p> <p class="Byline">by Ray N. Carnation</p> </div> <div class="Content"> <p><span class="LeadIn">Right now</span>, you're probably feeling pretty good. After all, life in the developed world is comfortable<span class="style1">—</span>probably more comfortable than it's been for the average human being throughout all of recorded history.</p> <p>But don't get too smug. There's still plenty of horrific ways it could all fall apart. In this article, you'll learn about a few of our favorites.</p> <h2>Mayan Doomsday</h2> <p>Skeptics suggest that the Mayan calendar simply rolls to a new 5,126-year era after 2012, and doesn't actually predict a life-ending apocalypse. But given that the long-dead Mayans were wrong about virtually everything else, why should we trust them on this? </p> <h2>Robot Takeover</h2> <p>Not quite as frightening as a Vampire Takeover or Living-Dead Takeover, a robot rebellion is still a disquieting thought. We are already outnumbered by our technological gadgets, and even Bill Gates fears the day his Japanese robot slave turns him over by the ankles and asks (in a suitably robotic voice) "Who's your daddy now?" </p> <h2>Unexplained Singularity</h2> <p>We don't know how the universe started, so we can't be sure it won't just end, maybe today, and maybe with nothing more exciting than a puff of anti-matter and a slight fizzing noise.</p> <h2>Runaway Climate Change</h2> <p>Dismissed by some, Al Gore's prophecy of doom may still come true. If it does, we may have to contend with vicious storms, widespread food shortages, and surly air conditioning repairmen.</p> <h2>Global Epidemic</h2> <p>Some time in the future, a lethal virus could strike. Predictions differ about the source of the disease, but candidates include monkeys in the African jungle, bioterrorists, birds and pigs with the flu, warriors from the future, an alien race, hospitals that use too many antibiotics, vampires, the CIA, and unwashed brussel sprouts. Whatever the source, it's clearly bad news. </p> </div> <div class="Footer"> <p class="Disclaimer">These apocalyptic predictions do not reflect the views of the author.</p> <p> <a href="AboutUs.html">About Us</a> <a href="Disclaimer.html">Disclaimer</a> <a href="ContactUs.html">Contact Us</a> </p> <p>Copyright © 2015</p> </div> </body> </html>
HTML5写法
css:
body{ font-family: "微软雅黑"; max-width: 800px; } header{ background-color:#7695FE; border:thin #336699 solid; padding:10px; margin: 10px; text-align: center; } header h1{ margin: 0px; color: white; font-size: xx-large; } header h2{ font-size:large; font-weight: bold; } header .Teaser{ font-size: large; font-weight: :bold; } header .Byline{ font-style: initial; font-size: small; margin: 0px; } .Content{ font-family:"微软雅黑"; font-size: medium; padding-top: 20px; padding-bottom: 5px; padding-left: 50px; padding-right: 50px; line-height: 120%; } .Content.LeadIn{ font-weight: bold; font-size: large; font-variant: small-caps; } .Content h2{ color:#336699; margin-bottom: 2px; font-size: medium; } .Content p{ margin-top: 0px; } footer{ text-align: center; font-size: x-small; } footer .Disclaimer{ font-style: italic; } footer p{ margin: 3px; } .FloatFigure{ float: left; margin-left: 0px; margin-top: 0px; margin-right: 20px; margin-bottom: 0px; } .FloatFigure figcaption{ max-width: 300px; font-size: :small; font-style: italic; margin-bottom: 5px; text-align: center; } .PullQuote{ float: right; max-width: 300px; border-top:thin black solid; border-bottom: thin black solid; font-size:30px; line-height: 130%; font-style: italic; padding-top: 5px; padding-bottom: 5px; margin-left: 15px; margin-bottom: 10px; } .PullQuote img{ vertical-align: bottom; }
html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>第二个页面</title> <link rel="stylesheet" href="css/my.css"> </head> <body> <article> <header> <h1>How the World Could End</h1> <p class="Teaser">Scenarios that spell the end of life as we know</p> <p class="Byline">by Ray N. Carnation</p> </header> <div class="Content"> <p><span class="LeadIn">Right now</span>, you're probably feeling pretty good. After all, life in the developed world is comfortable<span class="style1">—</span>probably more comfortable than it's been for the average human being throughout all of recorded history. </p> <figure class="FloatFigure"> <img src="resource/human_skull.jpg" alt="Human Skull" /> <figcaption>Bill Gates fears the day his Japanese robot</figcaption> </figure> <p>But don't get too smug. There's still plenty of horrific ways it could all fall apart. In this article, you'll learn about a few of our favorites. </p> <h2>Mayan Doomsday</h2> <p>Skeptics suggest that the Mayan calendar simply rolls to a new 5,126-year era after 2012, and doesn't actually predict a life-ending apocalypse. But given that the long-dead Mayans were wrong about virtually everything else, why should we trust them on this? </p> <h2>Robot Takeover</h2> <p>Not quite as frightening as a Vampire Takeover or Living-Dead Takeover, a robot rebellion is still a disquieting thought. We are already outnumbered by our technological gadgets, and even Bill Gates fears the day his Japanese robot slave turns him over by the ankles and asks (in a suitably robotic voice) "Who's your daddy now?" </p> <aside class="PullQuote"> <img src="resource/quotes_start.png" /> we may have to contend with vicious storms, widespread food shortages <img src="resource/quotes_end.png" /> </aside> <!--侧边栏 --> <h2>Unexplained Singularity</h2> <p>We don't know how the universe started, so we can't be sure it won't just end, maybe today, and maybe with nothing more exciting than a puff of anti-matter and a slight fizzing noise.</p> <h2>Runaway Climate Change</h2> <p>Dismissed by some, Al Gore's prophecy of doom may still come true. If it does, we may have to contend with vicious storms, widespread food shortages, and surly air conditioning repairmen.</p> <h2>Global Epidemic</h2> <p>Some time in the future, a lethal virus could strike. Predictions differ about the source of the disease, but candidates include monkeys in the African jungle, bioterrorists, birds and pigs with the flu, warriors from the future, an alien race, hospitals that use too many antibiotics, vampires, the CIA, and unwashed brussel sprouts. Whatever the source, it's clearly bad news. </p> </div> </article> <footer> <p class="Disclaimer">These apocalyptic predictions do not reflect the views of the author. </p> <p> <a href="AboutUs.html">About Us</a> <a href="Disclaimer.html">Disclaimer</a> <a href="ContactUs.html">Contact Us</a> </p> <p>Copyright © 2015</p> </footer> </body> </html>
素材