h5新增的结构标签

结构标签(块状元素)-----有意义的div

标签描述
article标记定义一篇文章
header标记定义一个页面或一个区域的头部
nav标记定义导航栏链接
section标记定义一个区域
aside标记定义内容部分的侧边栏
hgroup标记定义一个区块中相关内容
figure标记定义一组媒体内容
figcaption标记定义figure元素的标题
footer标记定义一个页面或一个区域的脚部
dialog标记定义一个对话框或会话框

现在用这些新增的结构标签做了一个HTML5布局图;在做dialog这部分的时候发现它不会继承父元素(article)的宽和高,继承了浏览器的宽和高,并且自动加了个边框,为什么是白色的?文字是白色的。而且位置也脱离了article这个元素,跑到了body里面。

效果:

代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="{CHARSET}">
		<title></title>
		<style type="text/css">
			*{
				margin:0;
				padding: 0;
			}
			body,html{
				width: 100%;
				height:100%;
				background: darkred;
				text-align: center;
				font-size: 20px;
			}
			header{
				width: 90%;
				background: #fff;
				
				margin: 10px auto;
			}
			nav{
				border-top: 1px solid #666;
			}
			section{
				margin: 10px auto;
				background: #fff;
				overflow: hidden;
				width: 87.3%;
				color: #fff;
				padding: 20px;
			}
			.d{
				color: black;
				height:30px;
				line-height: 30px;
				width: 100%;
				text-align: center;
			}
			aside{
				float: left;
				width: 42%;
				height: 400px;
				background: black;	
				line-height: 400px;
				margin-right: 15px;
				margin-top: 10px;
			}
			article{
				float: left;			
				width: 53%;
				height: 400px;
				background: black;
				text-align: center;
				padding: 0 20px;
				margin-top: 10px;
			}
			hgroup{
				background: darkred;
				height: 80px;
				text-align: center;
			}
			p{
				background: darkred;
				height: 100px;
				margin-top: 10px;
				line-height: 100px;
			}
			dialog{
				background: darkred;
				width: 46.3%;
				height: 100px;
				margin-top: 10px;
				margin-left: 620px;
				color: #fff;
			}
			footer{
				margin: 0 auto;
				background: #fff;
				width: 90%;
				height: 50px;
				line-height: 50px;
				text-align: center;
			}
		</style>		
	</head>
	<body>
		Body
		<header>
			header
			<nav><!--导航栏-->
				nav
				<a></a>
				<a></a>
				<a></a>
			</nav>
		</header>
		<section>
			<div class="d">section</div>
			<aside>
				侧边栏aside
			</aside>
			<article>
				article
				<hgroup>
					<h1>hgroup1:可爱的老鼠</h1>
					<h2>hgroup2:作者:2020</h2>
				</hgroup>
				<p>文章段落</p>
				<dialog open>
					dialog:
					<dt>作者评论</dt>
					<dd>读着评论</dd>
				</dialog>
			</article>
		</section>
		<footer>footer</footer>
	</body>
</html>

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值