批改状态:合格
老师批语:添加上运行示例图就更好了
unicode和Font class方式。
unicode方式font class方式
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>iconfont的使用</title><link rel="stylesheet" href="../iconfont/iconfont.css"><link rel="stylesheet" href="../iconfont/iconfont.css"></head><body><!-- 方式一:unicode方式 --><!-- 第一步:页面引入图标下面生成的iconfont.css文件,注意相对位置的问题 --><!-- 第二步:页面中需要用到iconfont的地方,加个类名iconfont,同时把该字体图标的实体字符写到文本中 --><span class="iconfont"></span><!-- 方式二:class方式 --><!-- 第一步:页面引入图标下面生成的iconfont.css文件,注意相对位置的问题 --><!-- 第二步:页面中需要用到iconfont的地方,加个类名:iconfont+空格+字体图标的名字 --><span class="iconfont icon-shezhi1"></span></body></html>
media Queries媒体查询,主要用于制作响应式布局,在允许不改变内容的情况下,在样式中选择一种页面布局以精确的适应不同的设备。宽度受限 高度无限width来进行查询从而确定元素的布局和渲染方式
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>响应式布局(media queries)模块</title><style>/* 1.没有媒体查询之前,页面的样式设置 *//* 使用float布局 */body,h2 {margin:0;padding:0;color:white;}#main,header,aside,footer {background-color: rgb(100, 100, 100);margin:5px 0;}h2 {text-align:center;font-size:3em;}#container {width:960px;margin:0 auto;}header {float:left;width:100%;line-height:100px;}#left {float:left;width:200px;line-height:400px;}#main {float:left;width:540px;line-height:400px;margin-left:10px;}#right {float:right;width:200px;line-height:400px;}footer {float:left;width:100%;line-height:80px;}/* 以下应用媒体查询,进行响应式布局, *//* 1.屏幕宽度在1024px以上使用的样式,类似于电脑*/@media (min-width:1024px){h2 {text-align:center;font-size:3.5rem;color:yellow;}#container {width:960px;margin:0 auto;}header {float:left;width:100%;}#left {float:left;width:200px;}#main {float:left;width:540px;margin-left:10px;}#right {float:right;width:200px;}footer{float:left;width:100%;}}/* 2.屏幕宽度在640px以上,1024px以下使用的样式,类似平板电脑 */@media screen and (min-width:640px) and (max-width:1023px) {h2{text-align:center;font-size:2.5rem;color:#f0f;}#container {width:600px;margin:0 auto;}#left {float:left;width:160px;}#main {float:left;margin-left:10px;width:430px;}/* 次要区块可以不在屏幕显示 */#right {display:none;}}/* 3.屏幕宽度在640px以下使用的样式,从上到下排列5行显示 */@media screen and(max-width:639px) {h2 {text-align:center;font-size:3.5rem;color:#0f0;}#container {width:400px;margin:0 auto;}#left {float:left;width:100%;line-height:100px;}#main {float:left;margin-left:0;width:100%;line-height:200px;}#right{width:100%;float:left;line-height:100px;}}</style></head><body><section id="container"><header><h2>header</h2></header><aside id="left"><h2>left</h2></aside><section id="main"><h2>main</h2></section><aside id="right"><h2>right</h2></aside><footer><h2>footer</h2></footer></section></body></html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号