老师 帮忙看一下

来源:4-10 自由编程

lcy_18

2021-03-02 14:43:00

我的宽度有点问题,文字那边因为设置了padding,然后宽度使用25%就没法具体减,要如何解决

.image-text{

width: 100%;

height: 760px;

overflow: hidden;

margin-top: 30px;

}

.image-text .image,.image-text .text{

width: 25%;

height: 380px;

float: left;

}

.image-text .image img{

width: 100%;

height: 380px;

}

.image-text .text{

background-color: #07CBC9;

padding:20px;

height: 340px;

width: 22.3%;

}

.image-text .text .text1{

padding-bottom: 30px;

font-size: 24px;

color: white;

}

.image-text .text .text2{

padding-bottom: 20px;

font-size: 16px;

color: white;

}

.image-text .text .text3{

padding-bottom: 30px;

font-size: 14px;

color: gray;

}

.image-text .text .text4{

width: 138px;

height: 40px;

margin: 0 auto;

background-color: black;

color: white;

text-align: center;

line-height: 40px;

}



<!-- 图文混排区域 -->

    <div class="image-text">

        <div class="image">

            <img src="images/b1.jpg">

        </div>

        <div class="text">

            <p class="text1">Library</p>

            <p class="text2">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

            <p class="text3">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>

            <p class="text4">EXPLORE</p>

        </div>

        <div class="image">

            <img src="images/b2.jpg">

        </div>

        <div class="text">

            <p class="text1">Library</p>

            <p class="text2">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

            <p class="text3">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>

            <p class="text4">EXPLORE</p>

        </div>

        <div class="text">

            <p class="text1">Library</p>

            <p class="text2">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

            <p class="text3">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>

            <p class="text4">EXPLORE</p>

        </div>

        <div class="image">

            <img src="images/b3.jpg">

        </div>

        <div class="text">

            <p class="text1">Library</p>

            <p class="text2">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

            <p class="text3">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>

            <p class="text4">EXPLORE</p>

        </div>

        <div class="image">

            <img src="images/b4.jpg">

        </div>

    </div>


写回答

2回答

好帮手慕张

2021-03-02

同学你好,问题解答如下:

由于代码中给.text设置了padding:20px;设置22.3%的宽度,导致每个区域的宽度不是想等的

修改:建议给.text设置和图片一样的高度380px,宽度设置为25%,去掉padding值设置

http://img.mukewang.com/climg/603e23fe0914b8c104040391.jpg

可在结构中添加一个包裹盒子(仅举例修改一个,其它需要同学参考修改),

http://img.mukewang.com/climg/603e253c09be8b3c07160382.jpg

给包裹盒子设置padding,如下图:

http://img.mukewang.com/climg/603e25740980c8df02950110.jpg

祝学习愉快!

0

好帮手慕张

2021-03-02

同学你好,由于同学只粘贴了css代码,老师使用之前同学提交过的结构骨架代码测试发现,同学样式中多个很多元素和结构中的元素对应不上,无法测试完整效果,建议同学粘贴全部代码上来,方便快速高效的检查代码。

祝学习愉快!

0
hcy_18
hp>html代码粘贴在css后面

h021-03-02
共1条回复

0 学习 · 15276 问题

查看课程