请老师检查一下我的代码有没有什么需要修改的地方,谢谢~

来源:2-17 自由编程

lascride

2021-04-29 16:02:05

<!-- 图文混排区域 -->
    <!-- Img&text -->
    <section class="img-text">
        <div class="img">
            <img src="./images/b1.jpg" alt="">
        </div>
        <div class="text texta">
            <h3>Library</h3>
            <p class="p1">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry
            </p>
            <p class="p2">
                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>
            <a href="">EXPLORE</a>
        </div>
        <div class="img">
            <img src="./images/b2.jpg" alt="">
        </div>
        <div class="text texta">
            <h3>Library</h3>
            <p class="p1">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry
            </p>
            <p class="p2">
                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>
            <a href="">EXPLORE</a>
        </div>
        <div class="text textb">
            <h3>Library</h3>
            <p class="p1">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry
            </p>
            <p class="p2">
                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>
            <a href="">EXPLORE</a>
        </div>
        <div class="img">
            <img src="./images/b3.jpg" alt="">
        </div>
        <div class="text textb">
            <h3>Library</h3>
            <p class="p1">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry
            </p>
            <p class="p2">
                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>
            <a href="">EXPLORE</a>
        </div>
        <div class="img">
            <img src="./images/b4.jpg" alt="">
        </div>
    </section>
/* 图文混排区域 */
.img-text {
    width: 100%;
    margin-top: 20px;
}
.img-text div {
    width: 25%;
    height: 380px;
    background-color: #07cbc9;
    float: left;
}
.img-text .img img {
    height: 100%;
    width: 100%;
}
.img-text .text {
    position: relative;
}
.img-text .texta::before {
    content:' ';
    width: 0;
    height: 0;
    border: 20px solid transparent;
    border-right-color: #07cbc9;
    position: absolute;
    /* top: 50%; */
    /* left: -90px; */
    top: 190px;
    margin-top: -10px;
    left: -40px;
}
.img-text .textb::after {
    content:' ';
    width: 0;
    height: 0;
    border: 20px solid transparent;
    border-left-color: #07cbc9;
    position: absolute;
    /* top: 50%; */
    /* left: -90px; */
    top: 190px;
    margin-top: -10px;
    right: -40px;
}
.img-text .text h3 {
    font-size: 24px;
    color: white;
    margin-bottom: 30px;
    margin-top: 20px;
    margin-left: 20px;
}
.img-text .text .p1 {
    margin-left: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
    font-size: 16px;
    color: #fff;
}
.img-text .text .p2 {
    color: gray;
    margin-left: 20px;
    font-size: 14px;
    margin-bottom: 30px;
}
.img-text .text a {
    display: block;
    width: 138px;
    height: 40px;
    background-color: #000;
    color: white;
    line-height: 40px;
    text-align: center;
    margin: 0 auto;
}
写回答

1回答

好帮手慕然然

2021-04-29

同学你好,代码实现效果还可以,基本没问题,存在以下几处细节建议优化一下,如图

http://img.mukewang.com/climg/608a6e1c09cd71b705470332.jpg

http://img.mukewang.com/climg/608a6e1c09a0745d05270453.jpg

http://img.mukewang.com/climg/608a6e1c091be7cf06620512.jpg

​祝学习愉快!

0
hascride
hp>好的. 谢谢老师的指点! 的确优化后的代码更简洁, 更易于理解了~

h021-04-29
共1条回复

0 学习 · 15276 问题

查看课程