会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132647个问题

在作业3中产生疑问:当我把第二、第三两个form注释掉时,运行效果一样,那我是否可以只写第一个form,这样更简洁?

一、没注释前

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作业3</title>
</head>
<body>
<table border="1" width="600" height="100" align="center" cellspacing="0"cellpadding="1">
    <tr>
        <td align="right">用户名:</td>
        <td align="center">
            <form action="ok.html" name="form1">
                <input type="text">
            </form>
        </td>
    </tr>
    <tr>
        <td align="right">密码:</td>
        <td align="center">
            <form action="ok.html" name="form2">
                <input type="password" name="password">
            </form>
        </td>
    </tr>
    <tr>
        <td align="right">性别:</td>
        <td align="center">
            <form action="ok.html" name="form3">
            <input type="radio" name="sex" checked>
            <lable for="man">男</lable>
            <input type="radio" name="sex">
            <lable for="woman">女</lable>
            </form>
        </td>
    </tr>
</table>
</body>
</html>

二、注释后

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作业3疑问</title>
</head>
<body>
<table border="1" width="600" height="100" align="center" cellspacing="0"cellpadding="1">
    <tr>
        <td align="right">用户名:</td>
        <td align="center">
            <form action="ok.html" name="form1">
                <input type="text">
            </form>
        </td>
    </tr>
    <tr>
        <td align="right">密码:</td>
        <td align="center">
<!--            <form action="ok.html" name="form2">-->
                <input type="password" name="password">
<!--            </form>-->
        </td>
    </tr>
    <tr>
        <td align="right">性别:</td>
        <td align="center">
<!--            <form action="ok.html" name="form3">-->
                <input type="radio" name="sex" checked>
                <lable for="man">男</lable>
                <input type="radio" name="sex">
                <lable for="woman">女</lable>
<!--            </form>-->
        </td>
    </tr>
</table>
</body>
</html>

效果一

image.png

效果二

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 601楼

style>
        .box{
            width: 234px;
            height: 300px;
            background-color: pink;
            position: relative;
            overflow: hidden;
        }
        .box1{
            width: 100%;
            height: 76px;
            background-color: orange;
            /*绝对定位  相对于已经定位的父元素定位*/
            position: absolute;
            /*据父元素上面的距离为300px*/
            top: 300px;
            /*据父元素的左侧距离为0*/
            left: 0px;
        }
        /*鼠标悬停在box上,子代box1*/
        .box:hover>.box1{
           /*据父元素上面的距离变为224*/
            top: 224px;
        }
        .box2{
            width: 303px;
            height: 375px;
            background-color: red;
            position: relative;
        }
        .box2>img{
            width: 100%;
            height: 100%;
        }
        .box3{
            width: 100%;
            height: 100%;
            background-color: salmon(0,0,0,.2);
            position: absolute;
            top: 0px;
            left: 303px;
        }
        .box2:hover>.box3{
            left: 0;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1"></div>
    </div>
    <div class="box2">
        <img src="img/370ad36f-425c-453a-b406-ccb2a0dffeec.jpg" alt="">
        <div class="box3"></div>
    </div>
</body>
</html>

老师,我这个代码哪里不对吗?为啥达不到老师说的效果


WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS常用属性 602楼

<style>
        *{
            margin: 0;
            padding: 0;
        }
        a{
            text-decoration: none;
        }
        .box{
            width: 303px;
            height: 375px;
            background-color: red;
            position: relative;

        }
        .box img{
            width: 100%;
        }
        .text{
            width: 100%;
            height: 88px;
            position: absolute;
            left: 0px;
            bottom: 20px;
            text-align: center;
        }
        .name{
            color: #fff;
            font-size: 21px;
            font-weight: 800;
        }
        .yang{
            color: #fff;
            font-size: 14px;
        }
        .yg{
            color: #ebce6b;
            font-size: 24px;
            font-weight: 700;

        }
    </style>
</head>
<body>
    <div class="box">
<a href="">
    <img src="img/370ad36f-425c-453a-b406-ccb2a0dffeec.jpg" alt="">
    <div class="text">
        <p class="name">MEIZU UR 高端定制耳机 预约</p>
        <p class="yang">【预约专用】私人定制,为你而声</p>
        <p class="yg">¥200</p>
    </div>
</a>
    </div>
</body>
</html>

老师,这个font代码在这里有啥作用?

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS常用属性 603楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 609楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 610楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 611楼

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

*{

    margin0;

    padding0;


}

.items{

    height450px;

    background-colorblueviolet;

    floatleft;

    padding10px;

    box-sizingborder-box;

}

.items>div{

    width100%;

    height100%;

    background-colorcoral;

}

/* 移动端 */

@media screen and(max-width:768px){

    .items{

    width50%;

}

}

/* ipad端 */

@media screen and(max-width:768px)and(max-width:992px)

{.items{

    width33%;

}


}

/*  pc端*/

@media screen and(max-width:768px){

.items{

    width25%;

}

}

    </style>

</head>

<body>

    <div class="box" >

        <div class="items">


        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

        <div class="items">

        </div>

    </div>

</body>

</html>

老师为什么我这个显示不出来呀

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS盒子模型 613楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 614楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 615楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637