请问这里的按钮怎么只有填充内容的一半呢

请问这里的按钮怎么只有填充内容的一半呢

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
        <link rel="stylesheet" type="text/css" href="CSS/common.css">
    </head>
    <body>
        <div class="header">
 
            <div class="logo">
                <img src="images/logo.png" />
            </div>
            <div class="menu">
                <ul>
                    <li>HOME</li>
                    <li>ABOUT</li>
                    <li>GALLERY</li>
                    <li>FACULTY</li>
                    <li>EVENTS</li>
                    <li>CONTACT</li>
                </ul>
            </div>
        </div>
        <div class="content">
            <div class="banner">
                <div class="beijin"></div>
            </div>
            <div class="about">
                <div class="bg1">
                    <div class="top">
                        <div class="h3" id="">
                            <h3>ABOUT</h3>
 
                        </div>
 
                        <p>Xi Jinping, general secretary of the Central Committee of the Communist Party of China
                            (CPC), presided over the 10th meeting of the central committee for deepening overall reform
                            Monday.</p>
                        <img src="images/bb3.jpg" />
                    </div>
                    <div class="left">
                        <div class="p1">
                            <p>
                                A WORD <br>ABOUT US
                            </p>
                        </div>
                        <div class="p2">
                            <p>
                                Xi Jinping, general secretary of the Central Committee of the Communist Party of China
                                (CPC), presided over the 10th meeting of the central committee for deepening overall reform
                                Monday.
                            </p>
                            <div class="btn">
                                <a href="#" class="btn-a">
                                    <p>EXPLORE</p>
                                </a>
 
 
                            </div>
 
                        </div>
 
 
                    </div>
                    <div class="right">
                        <div class="right-up">
                            <p>70000</p>
                            <span>Student</span>
                        </div>
                        <div class="right-down">
                            <p>600</p>
                            <span>Faculty</span>
                        </div>
                    </div>
 
                </div>
            </div>
            <div class="about2">
                <div class="bg2">
                    <ul>
                        <li>
                            <div class="1">
                                <img src="images/b1.jpg">
                            </div>
                        </li>
                        <li>
                            <div class="2">
                            <a href="#"><span>EXPLORE</span></a>  
                            </div>
                        </li>
                        <li>
                            <div class="3">
                                <img src="images/b2.jpg">
                            </div>
                        </li>
                        <li>
                            <div class="4">
                            <a href="#"><span>EXPLORE</span></a>  
                            </div>
                        </li>
                        <li>
                            <div class="5">
                            <a href="#"><span>EXPLORE</span></a>  
                            </div>
                        </li>
                        <li>
                            <div class="6">
                                <img src="images/b3.jpg">
                            </div>
                        </li>
                        <li>
                            <div class="7">
                            <a href="#"><span>EXPLORE</span></a>  
                            </div>
                        </li>
                        <li>
                            <div class="8">
                                <img src="images/b4.jpg">
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="gallery"></div>
        </div>
        <div class="footer"></div>
    </body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
*{
    padding0px;
    margin0px;
}
a{
    text-decorationnone
}
.header{
    width1910px;
    height80px;
    line-height80px;
    background-color#07cbc9;
    positionfixed;
}
.header .logo img{
    margin-left90px;
    floatleft;
    margin-top15px;
}
.header .menu{
    height80px;
    line-height80px;
    floatright;
    colorwhite;
}
.header .menu li{
    floatleft;
    line-height80px;
    margin-right10px;
    list-stylenone;
}
.content{
    width1910px;
    heightauto;
    overflowhidden;
     
}
.content .banner{
    margin-top80px;
}
.content .banner .beijin{
    backgroundurl(../images/banner3.jpg);
    width1910px;
     height600px;
    background-repeatno-repeat;
    background-size:1910px 600px;
    /* float: left; */
     
}
.content .about .bg1{
     
    width1910px;
    height800px;
     
}
.content .about .bg1 img{
    margin300px 580px;
}
.content .about .bg1 H3{
    floatleft;
    positionabsolute;
     
     
    font-size50px;
    margin60px 800px ;
     
}
 
 
.content .about .bg1 .top p{
     
    margin140px 740px;
    width300px;
    height100px;
    word-wrap: break-word;
    text-aligncenter;
    positionabsolute;
     
}
.about .bg1 .left .p1 p{
     positionabsolute
    font-size35px;
    text-aligncenter;
    margin-650px 320px;
}
.about .bg1 .left .p2{
    positionabsolute;
    width350px;
    height200px;
    border: darkgray 1px solid;
    margin-500px 320px;
    font-size20px;
    background: rgba(255,255,255,0.4);
    padding10px;
}
 
.about .bg1 .left .p2 .btn .btn-a{
    width50px;
     
}
.about .bg1 .left .p2 .btn .btn-a p{
    font-size20px;
    background-colorblack;
    padding10px 15px;
    colorwhite;
    borderblack 2px solid;
    margin8px 0;
    display: inline-block;
     
}
 
.about .bg1 .right-up{
     
    floatright;
    width:200px;
    height120px;
    margin-740px 400px;
    border#07CBC9 2px solid;
     
}
.about .bg1 .right-up p{
    font-size35px;
    line-height35px;
    margin15px 55px;
}
.about .bg1 .right-up span{
    font-size25px;
    line-height25px;
    margin0px 59px;
}
.about .bg1 .right-down{
     
    floatright;
    width:200px;
    height120px;
    margin-560px 400px;
    border#07CBC9 2px solid;
     
}
.about .bg1 .right-down p{
    font-size35px;
    line-height35px;
    margin15px 55px;
}
.about .bg1 .right-down span{
    font-size25px;
    line-height25px;
    margin0px 59px;
}
.about2 .bg2 ul{
    width1950px;
}
.about2 .bg2 ul li{
    list-stylenone;
    floatleft;
    border:black 1px solid;
    width480px;
    height400px;
    background-color#07CBC9;
    border#07CBC9;
}
.about2 .bg2 ul li img{
     
    width480px;
    height400px;
}
.about2 .bg2 li a{
    background#000000;
    color#FFFFFF;   
    height28px;
}
.about2 .bg2 li span{
    padding20px;
    font-size28px;
    line-height28px;
     
}

http://img1.sycdn.imooc.com//climg/5d78663a000177c614630649.jpg

正在回答

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

2回答

同学你好!

  1. 同学之前的按钮是在p标签上面直接设置了背景色,并且同学这里也将p标签转为了行内块元素。

    http://img1.sycdn.imooc.com//climg/5d78c1680915b34f04610269.jpg

    同学现在的这个按钮,同学是在a标签上写的背景色,同学虽然结构相同,但是写样式的方式与之前是不同的哦

  2. a标签的确覆盖了文字部分,所以会出现手形,但是并没有完全覆盖哦,没有完全覆盖就是因为p标签的样式导致的呢,所以同学在这里修改一下a标签的样式就可以了

    http://img1.sycdn.imooc.com//climg/5d78c3da09ca8ef308290478.jpg


如果我的回答解决了你的疑惑,请采纳,祝学习愉快~

好帮手慕柯南 2019-09-11 15:22:03

同学你好!

  1. 因为 <a>是内联元素 ,所以同学给a标签的设置的高度并没有生效

  2. 同学将a标签设置成块级元素block ,就可以给他设置高度以及宽度了,比如:

    http://img1.sycdn.imooc.com//climg/5d78a0860904f36d05420505.jpg

如果我的回答解决了你的疑惑,请采纳,祝学习愉快~

  • 我之前也问过一个关于按钮的问题就是about区的那个按钮,样式都差不多为什么这个就会出现这个问题呢,不能被文字填充高度吗
    2019-09-11 16:05:05
  • 我发现其实链接范围已经覆盖了文字部分了,鼠标移上去会变手指图案,但是这个背景色为什么就会这样呢
    2019-09-11 16:07:40
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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