博客列表 >html的页面机构及标签的认识

html的页面机构及标签的认识

归宿的博客
归宿的博客原创
2018年08月13日 15:30:42657浏览

8.10是跟着php网络班第一次学习,下面是作业内容

代码:

实例

<!DOCTYPE html>  <!-- 声明 html xml -->
<html>
<head>		<!-- 定义网页头部 -->
	<title>PHP</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href=".css">  <!-- rel属性:定义当前文档和被链接文档的关系,type属性:定义链接文档类型,href:定义被连接文档地址 --> <!-- 外部样式:为了共享 -->
	<link rel="shorcut icon" type="images/x-icon" href="images/icon.png">
	<script type="text/javascript" src=".js"></script>
	<style type="text/css">  /*内部样式:只针对当前页面*/
		/*tag标签:id名(名字前面加 #)、class名(名字前面加.)、 属性选择器*/
		body{background:red;}
		#box{width: 100px;height: 100px;background: red} /*id选择器*/
		.main{width: 100px;height: 100px;background: green} /*class选择器 类*/
		a{color: pink}
		a[href="https://www.baidu.com"]{color: black}
		a[href="http://www.php.cn"]{color: black}
		div a{color: black} #box a{}
	</style>
</head>
<body style="background:white;"> <!-- 内联样式:优先级高于内部样式 -->
	<img src="">

	<a href="https://www.baidu.com">baidu</a>
	<a href="http://www.php.cn">php.cn</a>
	<a href="ceshi.html">ceshi</a>
	<a href="#">#</a>

	<div id="box">
		<a href="">123</a>
	</div>
	<div class="main"></div>
	<div></div>
	<div></div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

总结:

html的结构:

<!document html>  头部声明

<html>    html

<head></head>   头部

<body></body>  内容部分

</html>    html结束符号

  1. 样式权限:行内/内联 > 内部样式  >外部样式;

  2. 第一次见到用href当元素设置属性值,学到了

    微信图片_20180813152637.jpg

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议