html标签、属性二

html标签、属性二

标签、属性整理

标注内容(标记为黄色):<mark></mark>
嵌套:<iframe></iframe>
自适应,默认为该属性(在不设置的情况下):scrolling=auto”
显示滚动:scrolling=”yes”
不显示滚动:scrolling=”no”
div的title属性鼠标放上去出现标记
id属性代表的是html的唯一标识符
style用于html指定css样式
class属性用于匹配css样式的class 样式的选择器
hidden属性 有true/false (隐藏/显示)
button是按钮,onclick是监听器
border是边框属性,solid是实线,float是浮动位置(left/right)
meta 与浏览器进行交互: meta http-equiv="Content-Type"
content 指定信息的值(类型):content="text/html"
charset 定义字符集: charset="utf-8"
css、html分开文件后在html中连接:link href=”…”
rel属性用于设置对象和链接目的间的关系,sylesheet -- 定义一个外部加载的样式表 
三目运算符(’ ’ ? ’ ’ : ’ ’  问号前、冒号前、冒号后)

##对应例子(有注释)

在这里插入代码片1<!--标注内容-->
<mark>标记为黄色</mark><br/>
<!--iframe嵌套-->
<iframe src="D:\AAA实习\网页\img\1.jpg" width="200" height="120"></iframe><br/>
<iframe src="D:\AAA实习\网页\img\1.jpg" width="400" height="300"></iframe><br/>
<iframe src="D:\AAA实习\网页\img\1.jpg" scrolling="auto"></iframe><br/><!--自适应,默认为该属性(在不设置的情况下)-->
<iframe src="D:\AAA实习\网页\img\1.jpg" scrolling="yes"></iframe><br/><!--显示滚动-->
<iframe src="D:\AAA实习\网页\img\1.jpg" scrolling="no"></iframe><br/><!--不显示滚动-->
2<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
		<title>属性</title>
		
	</head>
	<body>
		<div>
			<!--id属性代表的是html的唯一标识符-->
			<!--style用于html指定css样式-->
			<!--class属性用于匹配css样式的class样式的选择器-->
			<div id="show" style="width:190px;height:200px;background-color:red;></div>
			<a href="#" onclick="change();">改变颜色</a>
			<script type="text/javascript">
				var change=function(){
					var div=document.getElementById("show");
					div.style.backgroundColor=
					div.style.backgroundColor=='red'?
					'green':(div.style.backgroundColor=='green'?'blue':'red');
					<!--三目运算符(问号前、冒号前、冒号后)-->
				}
			</script>
		</div>
		
		<!--div的title属性-->
		<!--鼠标放上去出现标记-->
		<div title="测试">测试</div>

		<!--hidden属性-->
		<!--hidden---true/false-->
		<div title="测试!" id="eee" hidden="true" style="height:100px">测试</div>
		<!--onclick监听器-->
		<button onclick="var www=document.getElementById('eee');
		www.hidden=!www.hidden;">隐藏/显示</button>
		</body>
</html>
3<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
		<title>css应用</title>
		<!--class属性用于匹配css样式的class样式的选择器-->
		<style type="text/css">
			div.content{
				width:300px;
				height:120px;
				border:1px solid black;
				float:left;
			}
		</style>
	</head>
	<body>
		<div class="content">测试内容一</div>
		<div class="content">测试内容二</div>
		<div class="content">测试内容三</div>
	</body>
</html>
4<html>
	<head>
	<!--meta 与浏览器进行交互、content 指定信息的值(类型)、charset 定义字符集 -->
		<meta http-equiv="Content-Type" content="text/html"; charset="utf-8"/>
		<title>css、html分离</title>
		<!--border边框属性,solid实线-->
		<link href="text.css" rel="stylesheet" type="text/css">
	</head>
	<body>
		<div class="content">测试内容一</div>
		<div class="content1">测试内容二</div>
		<div class="content2">测试内容三</div>
	</body>
</html>
.content{
			width:300px;
			height:120px;
			border:1px solid black;
			float:left;
		}
.content1{
			width:400px;
			height:200px;
			border:2px solid blue;
			float:right;
		}
.content2{
			width:300px;
			height:120px;
			border:3px solid red;
			float:left;
		}```



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值