4-3 小慕医生项目开发练习

4-3 小慕医生项目开发练习

* {
padding: 0;
margin: 0;
}

/* 去掉所有ul和ol 的小圆点 */
ul,
ol {
list-style: none;
}

/* 去掉所有超链接的下划线 */
a {
text-decoration: none;
}

/* 使用继承性给body标签设置字体 */
body {
font: normal 14px/27px '微软雅黑'
}

/* 头部 */
header {}

header .header-top {
width: 1199px;
margin: 0 auto;
/* 清除浮动 */
overflow: hidden;
}

header .header-top .logo {
padding-top: 36px;
width: 192px;
height: 63px;
float: left;
}

header .header-top .logo h1 {
width: 192px;
height: 63px;
}

header .header-top .tool {
width: 266px;
height: 67px;
float: right;
padding-top: 35px;
}

header .header-top .tool .r1 {
margin-bottom: 10px;
}

header .header-top .tool .r1 .tel {
width: 32px;
height: 25px;
}

header .header-top .tool .r1 .telnumber {
font-size: 20px;
color: #00978E;
display: inline-block;
width: 146.9px;
height: 26px;
text-align: center;
}

header .header-top .tool .r1 .icon {
width: 24px;
height: 24px;
}

header .header-top .tool .r1 .cn-icon {
margin-right: 14.1px;
}

header .header-top .tool .r2 {
border: 1px solid rgba(202, 202, 202, 0.60);
width: 264px;
height: 28px;
}

header .header-top .tool .r2 input {
float: left;
width: 224px;
height: 28px;
border: none;
padding-left: 20px;
/* 去掉鼠标点击时候的蓝色框 */
outline: none;
}

header .header-top .tool .r2 button {
float: left;
width: 20px;
height: 20px;
/* 去掉按钮背景 */
background: none;
border: none;
outline: none;
/* 设置触碰时的鼠标指针样式 */
cursor: pointer;
position: relative;
top: 3px;
right: 3px;
}

header .main-nav {
height: 60px;
background: #00978E;
margin-top: 20px;
}

header .main-nav ul {
width: 1200px;
height: 60px;
margin: 0 auto;

}

header .main-nav ul li {
float: left;
width: 150px;
height: 60px;
text-align: center;
line-height: 60px;
}

header .main-nav ul li:first-child {
background-color: #015E58;

}

header .main-nav ul li a {
display: block;
width: 150px;
height: 60px;
font-size: 16px;
color: white;
}

header .main-nav ul li a:hover {
background-color: orange;
}

老师,请检查,工具栏那里的边框下框线不见了,什么原因?我看了下后台显示r1部分的行高是33px ,但代码中我只设置到了26px,是什么原因?除了我提到的这些,麻烦老师帮忙看下还有其他什么问题

https://img1.sycdn.imooc.com//climg/634cd3a409e1090d00000000.jpg


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
imooc_慕慕 2022-10-17 13:57:15

同学你好,

1、由于设置的padding-top值太大了,导致被挤下去了

https://img1.sycdn.imooc.com//climg/634cee38097fc38803140161.jpg

2、在body上设置的font导致的高度发生了变化,去掉之后就可以了

https://img1.sycdn.imooc.com//climg/634ceeb7094e368204660606.jpg

3、整体代码时可以的,建议设置px值时尽量使用整数

祝学习愉快~

  • 提问者 慕移动4506339 #1
    1. 我是按照设计图上的padding值设置的,设计图上是是36px; 另外,padding-top 值为什么能影响到工具栏被挤下去?设置的工具栏的高不就是内容的高吗?跟padding 不影响

      https://img1.sycdn.imooc.com//climg/634d16310942464517500430.jpg



    2022-10-17 16:58:19
  • imooc_慕慕 回复 提问者 慕移动4506339 #2

    同学你好,非常抱歉老师忽略了一个小点,这里重新回答一下

    设置padding-top值会使元素高度发生变化,又因为在header部分设置了overflow:hidden;超出隐藏,因此input下边框看不见了。

    上面修改padding-top修改这种bug的一种方式,因为图片与文字的水平基线是不一样的因此文字距离上面的36px是不标准的,在开发中以实际效果进行微调是可以的。

    https://img1.sycdn.imooc.com//climg/634d31d109df7c6404370154.jpg

    调整右边盒子的高度也可以


    https://img1.sycdn.imooc.com//climg/634d32fa096a7bd613150504.jpg


    2、由于基线的问题,导致r1的高度出现了33px,我们设置vertical-align属性

    https://img1.sycdn.imooc.com//climg/634d33a20911be9006530128.jpg

    https://img1.sycdn.imooc.com//climg/634d337709be025e04580135.jpg

    祝学习愉快~

    spacer.gif

    2022-10-17 18:51:23
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师