Home >
Web Front-end >
H5 Tutorial >
Sharing several page examples of HTML5 design and modification_html5 tutorial skills
Sharing several page examples of HTML5 design and modification_html5 tutorial skills
WBOY
Release: 2016-05-16 15:46:27
Original
1849 people have browsed it
To understand and become familiar with the new semantic elements in HTML5, the best way is to take a classic HTML document as an example, and then enrich it with some fresh nutrients of HTML5. The following is the page we want to transform. The page is very simple and contains only one article.
ApocalypsePage_Original.html, this is a page with a very standardized format, and all styles come from external style sheets.
<pclass="Teaser">Scenarios that spell the end of life as we knowp>
<pclass="Byline">by Ray N. Carnationp>
div>
<divclass="Content">
<p><spanclass="LeadIn">Right nowspan>, you're probably feeling pretty good. After all, life in the developed world is comfortable<spanclass="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 Doomsdayh2>
<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 Takeoverh2>
<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 Singularityh2>
<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 Changeh2>
<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 Epidemich2>
<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>
<divclass="Footer">
<pclass="Disclaimer">These apocalyptic predictions do not reflect the views of the author.p>
padding: 10px; /* 10 pixel padding, the distance between the border and the content*/
margin: 10px; /* 10 pixel margin, the distance between the border and surrounding elements*/
text-align: center; /*Header text is centered*/
}
/*Title in header<h1>Style*/
.Header h1{
margin: 0px;
color: white;
font-size: xx-large; /*Precise control can be done in pixels or em units*/
}
/*Header subtitle style*/
.Header .Teaser{
margin: 0px;
font-weight: bold;
}
/*Signature line style in header*/
.Header .Byline{
font-style: italic;
font-size: small;
margin: 0px;
}
.Content{
font-size: medium;
font-family: Cambria, Cochin, Georgia, "Times New Roman", Times, serif;
/*Maximum left and right padding*/
padding-top: 20px;
padding-right: 50px;
padding-bottom: 5px;
padding-left: 50px;
line-height: 120%; /*The distance between two adjacent text lines*/
}
.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;
}
In this way, our style sheet has been bent. Now let’s see what the result will be? As shown below:
Use HTML5 to construct the page
Still a must-have element in web design, it is an intuitive, versatile container that allows you to apply styles to any block on the page. But the problem with
is that it itself doesn't reflect any information about the page.
To improve this situation with HTML5, replace
with an element with more descriptive semantics.
In ApocalypsePage_Revised.html, the class attributes of Header and Footer and
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn