老师,为什么我引图片图片没出来呢?
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
.box{
width: 1300px;
width: 1400px;
background-image: url("/第一阶段:HTML5和CSS3/8.背景属性一/01.jpg");
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
/* 导航样式开始 */ .nav { width: 100%; height: 66px; background: #88c5e1; border-bottom: 5px solid #54abd4; } .wrap { width: 87%; margin: 0 auto; } .logo, .nav-bar, .search { float: left; height: 66px; } .search .text-input { width: 100%; height: 40px; background-color: #f5f5f5; border: 1px solid #f5f5f5; box-sizing: border-box; border-radius: 2px; outline: none; margin-top: 13px; padding-left: 10px; transition: all 0.2s; } .search button { width: 40px; height: 34px; background-color: #f5f5f5; color: #54abd4; font-weight: 900; position: absolute; top: 16px; right: 2px; } .text-input:hover { background-color: #f5f5f5; border-color: #54abd4; } .nav-bar>ul { float: right; } .nav-bar ul li { float: left; } .nav-bar ul li a { color: #fff; padding: 10px; display: block; margin-left: 8px; margin-top: 12.5px; } .nav-bar-active { border-bottom: 2px solid #fff; } .nav-bar a:hover { border-bottom: 2px solid #fff; } /* 导航样式结束 */ /* ************** 响应式设计 *********** */ /* pc端 */ @media screen and(min-width:992px) { .logo { width: 25%; background: url("../images/Brand.png") no-repeat left; background-size: 183px; } .search { width: 40%; position: relative; } .nav-bar { width: 35%; } .btn { display: none; } } /* pad端 */ @media screen and(min-width:768px) and (max-width:992px) { .logo { width: 18%; background: url("../images/Brand-M.png") no-repeat left; background-size: 86px; } .search { width: 42%; position: relative; } .nav-bar { width: 40%; } .btn { display: none; } } /* M端 */ @media screen and(max-width:768px) { .logo { width: 16%; background: url("../images/Brand-S.png") no-repeat left; background-size: 38px; } .search { width: 68%; position: relative; } .nav-bar { display: none; } .btn { width: 43px; height: 43px; border: 1px solid #fff; font-weight: 700; line-height: 43px; float: right; color: #fff; margin-top: 10.5px; } .btn i { font-size: 20px; } }
也不知道哪里出问题了,对照着源码对了好几遍了,但是源码复制过来就没问题了
ul标签可以和ol互相嵌套吗?
不用了不用了,选择器上打错了
代码和视频的是一样的,咋就出不来?
用谷歌调试工具的话也不会动
<style> div>h3{ color:red;} </style> <body> <div> <h3>这是一个标题</h3> <p> <h3>这是一个标题</h3> </p> </div> </body>
为什么子代选择器下面p标签里孙子级的h3也会被选中呢?
1、电脑端
2、手机端
注意:
1、手机<768, 平板 >768 <992 , 小屏幕 >992 <1240,大屏幕 >1240
2、浮动造成的影响:父级元素坍塌、同级块元素显示错误
实操要点:
1、图像定位:通过给父级容器设置相对定位,给照片设置绝对定位改变图像位置
2、图像旋转:通过设置transform:rotate(10deg);来设置旋转角度
实操要点
1、想要达到每4个div之后,消除第4个的边距效果,使其在一行显示:
ul li:nth-child(4n) {
margin-right: 0px;
2、想要让元素居中摆放,textalign=center;这个属性要注意位置,要放在整体的容器(display=block)里面
3、图片上定位文字:首先要把父级元素定位设为相对顶位,随后就可以把文字设为绝对定位,覆盖在本来的父级元素上面;
这个实战中,可以直接使用后代选择器效果是一样的:
.nav ul li:hover .list-div{
display: block;
老师,我对这个三角形提醒的绘制还是有点看不懂
嗷嗷刚刚代码那个p标签写在div外面了,现在解决了,用两种方式清楚浮动都可以了
*{
margin: 0;
padding: 0;
.nav{
width: 100%;
height: 68px;
background-color: rgba(0,0,0,.85);
.nav ul {
list-style: none;
margin-left: 300px;
line-height: 68px;
/* overflow: hidden; */
.nav ul::after{
content: "";
overflow: hidden;
clear: both;
.nav ul li{
float: left;
padding: 0 20px;
.nav ul li a{
text-decoration: none;
color: white;
.nav ul li a:hover{
color: #ff6700;
p{
<div class="nav">
<ul>
<li>
<a href="#">小米商城</a>
</li>
<a href="#">小米影像</a>
<a href="#">MIUI</a>
<a href="#">LOT</a>
<a href="#">云服务</a>
<a href="#">天星科技</a>
<a href="#">有品</a>
<a href="#">小爱开放平台</a>
<a href="#">企业团购</a>
</ul>
<p>testtest</p>
</div>
<meta name="viewport" content="width=, initial-scale=1.0">
display: inline;
老师为啥这个结果不用清除浮动,也可以p标签在下面?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637