老师,请检查代码是否正确,哪里需要调整

老师,请检查代码是否正确,哪里需要调整

# 具体遇到的问题

# 报错信息的截图

# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style type="text/css">

        .banner{

        width: 100%;

        height: 600px;

        position: relative;

        }

        .banner img{

            width: 100%;

            height: 600px;

            position: absolute;

        }

        .banner .content{

            width: 100%;

            height: 600px;

            background: rgba(0, 0, 0, .5);

            position: absolute;

        }

        .banner .content form{

            width: 520px;

            height: 400px;

            position: absolute;

            top: 100px;

            left: 50%;

            margin-left: -200px;

            background: none;

        }

        .banner .content form p{

            margin-bottom: 20px;

            text-align: center;

        }

        .banner .content form input{

            width: 504px;

            height: 40px;

            background: none;

            border: 1px solid #888;

        }

        .banner .content form input.submit{

            width: 200px;


        }

        .banner .content form textarea{

            width: 504px;

            height: 110px;

            background: none;

            border: 1px solid #888;

        }

    </style>

</head>

<body>

    <div class="banner">

        <img src="images/banner3.jpg" alt="">     

        <!-- banner遮罩层    -->

        <div class="content">

            <!-- banner表单    -->

            <form action="">

                <p><input type="text" placeholder="YourName"></p>

                <p><input type="password" placeholder="YourPhone"></p>

                <p><input type="email" placeholder="YourEmial"></p>

                <p><textarea name="" id="" cols="40" rows="6" placeholder="YourComment"></textarea></p>

                <p> <input class="submit" type="submit" value="SEND MESSAGE"></p>

            </form>

        </div>        

    </div>

</body>

</html>


正在回答

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

1回答

同学你好,代码中有几处需要调整一下

1、body有默认的margin值,建议:清除body的默认margin值,效果会更美观。代码参考:

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

2、表单整体没有实现水平居中的效果,左右间距不一样,如下:

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

建议:form标签的宽度为520px,left值设置为50%,margin-left应该设置为form宽度的一半(负值),代码参考:

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

问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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