老师麻烦检查下

来源:2-5 编程练习

豆包侠

2021-09-26 11:21:05

<!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>

*

{

    margin0;padding0;

}

.main

{

    width1200px;  height500px;margin36px auto;

}

.main > aside

{

    floatleft;   width350px;

}

.main > article

{

    floatright;  width850px;

}


.main h1

{

    font-size40px;  font-weightlighter;positionrelative;left-40px;margin-bottom15px;

}

.main h1 > samp

{

    font-size40px;  color#ccc;

}

.main > aside > dl

{

    positionrelative;  displayblock;  overflowhiddenheight60px;margin-bottom36px;

}


.main > aside > dl > dt

{

    font-size16px;  font-weightboldline-height20px;  positionrelativeleft60pxtext-decorationunderline;

}

​.main > aside > dl > dd:first-of-type

{

    positionabsolute;  top10pxleft0;

}

.main > aside > dl > dd:last-of-type

{

    font-size14px;  font-weightlighterpositionabsolute;left60px;

}

article p

{

    font-size14px;  font-weightlighter;

}


.main > article > p,

.main > article > img

{

    margin-bottom10px;  margin-left20px;

}

.main span

{

    font-size20px;  positionabsolutez-index2                                                                                         ;top12%;


top50%;


left50%;


transformtranslate(-50%-50%);


color#fff;

}



.main > dl > dd > img

{

    width100%;height100%;

}

article img

{

    width850px;  height220px;

}


.main > article > h1

{

    margin-left54px;

}

 </style>

</head>

<body>

    <section class="main">

        <aside>

            <h1>Recent<samp>Course</samp></h1>

            <!-- 左侧标题部分 -->

            <dl>

                <dt>Hyper Text Markup Language</dt>

                <dd><span>1</span><img src="http://climg.mukewang.com/582e61290001787900500051.png"></dd>

                <dd>HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites.</dd>

            </dl>

            <!-- 第一组 -->

            <dl>

                <dt>Cascading Style Sheets</dt>

                <dd><span>2</span><img src="http://climg.mukewang.com/582e61290001787900500051.png"></dd>

                <dd>Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents.</dd>

            </dl>

            <!-- 第二组 -->

            <dl>

                <dt>JavaScript</dt>

                <dd><span>3</span><img src="http://climg.mukewang.com/582e61290001787900500051.png"></dd>

                <dd>JavaScript is a high-level, dynamic, untyped, and interpreted programming language</dd>

            </dl>

            <!-- 第三组 -->

            <dl>

                <dt>AngularJS</dt>

                <dd><span>4</span><img src="http://climg.mukewang.com/582e61290001787900500051.png"></dd>

                <dd>AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</dd>

            </dl>

            <!-- 第四组 -->

        </aside>

        <article>

            <h1>Welcome to <samp>Massive Open Online Course!</samp></h1>

            <p> We provide the latest knowledge to help you cope with the changing world!</p>

            <img src="http://climg.mukewang.com/582e61180001ede703300130.jpg" >

            <p>We hope that all the students who love the Internet can be more convenient access to learning resources, using the Internet thinking to change our learning.</p>

            <p>Focus on IT skills education MOOC, consistent with the development trend of the Internet down to earth's MOOC. We are free, we only teach useful, we concentrate on education.</p>

        </article>

    </section>

    <!-- 左侧边栏 -->

    

</body>

</html>


写回答

1回答

好帮手慕久久

2021-09-26

同学你好,代码中有如下问题:

1、左侧第二个dd,部分内容被隐藏了:

https://img.mukewang.com/climg/614fea9e09c5585606450149.jpg

原因是父元素设置了固定高度,并设置了overflow: hidden;。由于dd中的内容比较多,部分内容超出了父元素,因此内容没有显示完整。

建议不给父元素设置固定高度,让其高度由内容撑开:

https://img.mukewang.com/climg/614feb370941194905560245.jpg

https://img.mukewang.com/climg/614feb5009492de004330199.jpg

2、优化建议:右侧图片超出了父元素:

https://img.mukewang.com/climg/614feb7b09d399fe11280328.jpg


建议考虑margin-left,调整一下图片的宽度,让其刚好占满父元素:

https://img.mukewang.com/climg/614febbb095b2b7504760166.jpg

同学可以再调整一下细节,让效果更好看,比如增大aside的宽度。

祝学习愉快!

0

0 学习 · 40143 问题

查看课程