家电维修班,手机维修班,电脑维修班,电工班,焊工班,液晶电视维修班,电动工具维修班、电动车摩托车维修班、网络营销培训、网站设计培训、淘宝培训---全国招生 家电维修班,手机维修班,电脑维修班,电工班,焊工班,液晶电视维修班,电动工具维修班、电动车摩托车维修班、网络营销培训、网站设计培训、淘宝培训---全国招生
淘宝网店培训,淘宝网店培训学校,淘宝网店培训课程
最新报名学员名单(实时滚动)
最新就业创业学员名单
您的位置:网站首页 > 网络营销 > 网站制作 > HTML5几个设计和修改的页面范例分享

HTML5几个设计和修改的页面范例分享

来源: 日期:2015-11-01 22:12:37 人气:标签:

HTML5几个设计和修改的页面范例分享


要了解和熟悉 html5 中的新的语义元素,最好的方式就是拿一经典的 html 文档作例子,然后把 html5 的一些新鲜营养充实进入。如下就是我们要改造的页面,该页面很简单,只包含一篇文章。

apocalypsepage_original.html,这是一个格式非常规范的页面,所有的样式均来自于外部样式表。

<!doctype html>

<html lang="zh-cn">

<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><!-- end 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>

<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><!-- end content -->

<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 © 2014</p>

</div><!-- end footer -->

</body>

</html>

在不增加任何 css 样式表之前,效果如下:

html5几个设计和修改的页面范例分享

上面通过三个 <div> 将页面分成了三个部分,顶部的页眉,中部的内容和底部的页脚。

这个例子中的样式表很简单,整个页面最大宽度设置为 800 像素,避免文本在宽屏显示器上显示过长。页眉位于一个带有蓝色边框的盒子中,内容区的两侧都增加了内边距,而页脚在整个页面的底部居中。

apocalypsepage_original.css样式文件内容如下:

@charset "utf-8";

/* css document */

body{

/*font-family 要使用安全字体,按照先特殊后一般的原则,

先给出你想要的字体,然后是保险一些的字体,

最后以 sans-serif 字体结尾*/

font-family: "lucida sans unicode", "lucida grande", geneva, sans-serif;

max-width: 800px; /*最大宽度不超过 800 像素*/

}

/*页面顶部的标题区样式*/

.header {

background-color: #7695fe; /*可接受任何颜色值*/

border: thin #336699 solid; /*多合一的 border 属性*/

padding: 10px; /* 10像素的内边距,边框与内容之间的距离*/

margin: 10px; /* 10像素的外边距,边框与周围元素之间的距离*/

text-align: center; /*头部文本居中*/

}

/*页眉中标题<h1>样式*/

.header h1{

margin: 0px;

color: white;

font-size: xx-large; /*精确控制可以用像素或者em单位*/

}

/*页眉中子标题样式*/

.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 new roman", times, serif;

/*左右内边距最大*/

padding-top: 20px;

padding-right: 50px;

padding-bottom: 5px;

padding-left: 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;

}

这样我们的样式表就弯沉过了,现在去看看结果会怎样呢?如下图:

html5几个设计和修改的页面范例分享

使用 html5 来构造页面

<div> 目前仍旧是 web 设计的必备元素,它是一个直观、多用途的容器,可以通过它为页面中的任何区块应用样式。但 <div> 的问题在于,它本身不反映与页面相关的任何信息。

要通过 html5 改进这种情况,可以把 <div> 替换成更具有描述性语义的元素。

apocalypsepage_revised.html中已经将 class 属性为 header 和 footer 两个 <div> 替换为 <header> 和 <footer>, 部分代码如下:

<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>

...

<footer>

<p class="disclaimer">these apocalyptic predictions do not reflect the views of the author.</p>

<p>

<a href="aboutus.html">about us</a>

...

</p>

<p>copyright © 2014</p>

</footer>

当然,对应的 apocalypsepage_revised.css 文件也需要进行修改,将其中的 .header 和 .footer 替换为 header 和 footer 。部分代码如下:

/*页面顶部的标题区样式*/

header {

background-color: #7695fe; /*可接受任何颜色值*/

border: thin #336699 solid; /*多合一的 border 属性*/

padding: 10px; /* 10像素的内边距,边框与内容之间的距离*/

margin: 10px; /* 10像素的外边距,边框与周围元素之间的距离*/

text-align: center; /*头部文本居中*/

}

/*页眉中标题<h1>样式*/

header h1{

margin: 0px;

color: white;

font-size: xx-large; /*精确控制可以用像素或者em单位*/

}

最后还有一个元素需要用在示例文件中,就是 <article> 元素,表示一个完整的、自成一体的内容。

<ariticle>元素应该包含新闻报道或文章的内容,包括标题、署名和正文。因此添加了 <article> 元素后的结构如下:

<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>

...

</div><!-- end content -->

</article>

重新设计后,页面结构如下:

html5几个设计和修改的页面范例分享

用 <figure> 添加插图

很多页面都是包含图片的。但是,插图 (figure) 与图片的概念还不完全一样。插图虽然独立于文本,但是文本中会提到它。

一般来说插图应该是浮动的,还会有浮动图题。下面是在文章中添加插图的 html 标记,在正文的第一段和第二段之间的位置,部分代码如下:

...

<div class="content">

<p><span class="leadin">right now</span>, you're ...</p>

<div class="floatfigure">

<img src="human_skull.jpg" alt="human skull">

<p>will you be the last person standing if one of these apocalyptic

scenarios plays out?</p>

</div>

<p>but don't get too smug. there's...</p>

...

相应的 样式表规则如下:

.floatfigure{

float: left;

margin: 0px 20px 0px 0px;

}

.floatfigure p{

max-width: 300px;

font-size: small;

font-style: italic;

margin-bottom: 5px;

}

下图展示了这个示例的外观,插图恰好在第一段文本之后,浮动在后面文本的左侧,图题的文本的宽度我们限制住了,让图题显示很充实、很优雅。

html5几个设计和修改的页面范例分享

html5 中提供了一个 <figure> 元素,图题可以放在 <figure> 中的 <figcaption> 元素里,经过改造,代码如下:

<figure class="floatfigure">

<img src="human_skull.jpg" alt="human skull">

<figcaption>will you be the last person standing if one of these apocalyptic

scenarios plays out?</figcaption>

</figure>

当然样式表中的选择符,相应修改一下即可。

.floatfigure{

float: left;

margin: 0px 20px 0px 0px;

}

.floatfigure figcaption{

max-width: 300px;

font-size: small;

font-style: italic;

margin-bottom: 5px;

}

最后还有就是 <img> 元素中的 alt 属性可以删除掉,因为图题中包含了图片的完整说明。

用 <aside> 添加附注

新的 <aside> 元素表示与它周围的文本没有密切关系的内容。可以通过它介绍另一个相关的话题,或者对主文档中提出的某个观点进行解释。还可以用来放置广告、相关内容链接。

下面的示例中将用作醒目引文(pull quote),使用 <div> 元素可以创造这种效果,但是用 <aside> 元素让标记更有意义:

html5几个设计和修改的页面范例分享

部分代码如下:

<p>... (in a suitably robotic voice) "who's your daddy now?"</p>

<aside class="pullquote">

<img src="quotes_start.png" alt="quote">

we don't know how the universe started, so we can't be sure it won't just end, maybe today.

<img src="quotes_end.png" alt="end quote">

</aside>

<h2>unexplained singularity</h2>

对应的样式表内容如下:

.pullquote{

float: right;

max-width: 300px;

border-top: thin black solid;

border-bottom: thick 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;

}

联系方式

  • 0731-85579057 , 0731-85569651
  • 点击这里给我发消息点击这里给我发消息点击这里给我发消息

关键字

电子商务课程介绍 电子商务培训 电子商务培训费用 淘宝网店课程介绍 淘宝网店培训 淘宝网店培训费用 电商培训 电商培训费用 网商培训课程 网商培训 淘宝网店咨询 电子商务咨询 企业官网 独立网站 阿里旺铺 网站建设 网站优化 网站托管 淘宝网店培训 电子商务培训 网站优化 淘宝网店课程 电子商务课程 电商培训 电商培训课程 电子商务培训 电子商务课程 电子商务培训课程 阿里电子商务培训 阿里淘宝网店培训 淘宝网店课程 淘宝网店资迅 淘宝网店信息 淘宝网店培训 系统化淘宝网店培训 广东淘宝网店培培训 湖南淘宝网店培训 湖北淘宝网店培训 河南淘宝网店培训 河北淘宝网店培训 山西淘宝网店培训 山东淘宝网店培训 陕西淘宝网店培训 江西淘宝网店培训 江苏淘宝网店培训 浙江淘宝网店培训 福建淘宝网店培训 贵州淘宝网店培训 广西淘宝网店培训 四川淘宝网店培训 青海淘宝网店培训 云南淘宝网店培训 辽宁淘宝网店培训 黑龙江淘宝网店培训 吉林淘宝网店培训 海南淘宝网店培训 内蒙淘宝网店培训 北京淘宝网店培训 上海淘宝网店培训 天津淘宝网店培训 重庆淘宝网店培训 长沙淘宝网店培训 株洲淘宝网店培训 湘潭淘宝网店培训 衡阳淘宝网店培训 邵阳淘宝网店培训 岳阳淘宝网店培训 常德淘宝网店培训 张家界淘宝网店培训 益阳淘宝网店培训 郴州淘宝网店培训 永州淘宝网店培训 怀化淘宝网店培训 娄底淘宝网店培训 湘西淘宝网店培训 湖南淘宝网店培训 望城淘宝网店培训 浏阳淘宝网店培训 长沙市网站优化 湖南网站优化 淘宝网店咨询 seo优化培训课程 旺铺优化培训 旺铺优化课程 旺铺优化培训课程 长沙旺铺优化培训 湖南旺铺优化培训 搜索引擎优化咨询 SEO优化咨询 湖南旺铺优化咨询 湖南旺铺优化培训 长沙旺铺优化咨询 seo优化咨询 seo咨询 湖南seo咨询 长沙seo咨询 南昌seo咨询 南昌seo优化咨询 阿里巴巴旺铺 网站建设 企业官网 网站优化 网站装修 网站托管 电子商务咨询 淘宝网店咨询 网商咨询 网站建设 网站美化 网站SEO优化 企业官网服务 阿里旺铺服务 电子商务培训 电商培训 SEO培训 营销型网站建设培训 南昌营销型网站 建网站 网站建设 独立网站建设 湖南建网站 南昌建网站 湖南网站建设 南昌网站建设 长沙网站建设 网站优化 广东网站优化 湖南网站优化 南昌网站优化 企业官网优化 企业官网SEO优化 独立网站SEO优化 独立网站改版 独立网站装修美化 企业官网装修 旺铺装修 旺铺seo 建网站公司 网站装修 网站建设培训 网站优化培训 优化

相关文章

友情链接: 技术文章 液晶电视维修培训 电动工具维修培训 电脑维修培训 电脑维修学校 家电维修学校 家电维修培训学校 电脑维修培训学校 焊工培训学校 电工学校 电工培训学校 培训课程 学校资讯 就业指导 招生指南 学生感言 入学须知 教学大纲 学校图片 网络营销 网络推广 网络营销招生 网络营销基础 网络营销动态 网络营销技巧 网络营销常识 网络营销策略 网络营销教程 淘宝网店 网站优化 电商 电子商务 淘宝开店 学开网店 微信营销 微店 网站制作 移动营销 推广软件 更多>>



阳光-网络营销教育品牌机构
点击这里给我发消息 点击这里给我发消息 点击这里给我发消息
电工培训学校 电动车维修学校 摩托车维修学校 摩托车维修培训 手机维修培训 家电维修培训 电脑维修培训 电动工具维修培训 液晶电视维修培训 安防监控培训 空调维修培训 网络营销培训 网站设计培训 淘宝网店培训 电器维修培训 家电维修学校 电工培训 焊工培训 电工学校