请检查作业,为什么表单的背景颜色一定要加在<table>上,加在<form>上显示不出来?

来源:2-2 编程练习

愛码仕

2020-04-17 00:58:35

<!doctype html>

<html>

<head>

    <meta charset="UTF-8" />

<title></title>

</head>

<body>

<!--此处填写代码-->

<h1>注册信息</h1>

<hr color="blue"/>

<form>

    <table bgcolor="#f2f2f2" width="600px">

        <tr>

            <td>用户名:</td>

            <td><input type="text" name="username" placeholder="请输入用户名" maxlength="6" size="25"/> </td>

        </tr>

        <tr>

            <td>密码:</td>

            <td><input type="password" name="psw" placeholder="请输入密码" maxlength="6" size="25"/></td>

        </tr>

        <tr>

            <td>确认密码:</td>

            <td><input type="password" name="confirmpsw" placeholder="请重新输入密码" maxlength="6" size="25"/></td>

        </tr>

        <tr>

            <td>上传照片:</td>

            <td><input type="file" name="pic"/></td>

        </tr>

    </table>

</form>

</body>

</html>


写回答

1回答

好帮手慕码

2020-04-17

同学你好,标题与表单项都要水平居中哦,可以给标题以及表格添加align属性,例:

http://img.mukewang.com/climg/5e991b5409b3dfe104870161.jpg

form标签可以设置属性,例如class,id等。而背景色属性bgcolor 是规定表格的背景颜色,也就是说它属于表格标签的属性,不能设置在其他标签上。(注:body标签也可以设置bgcolor,不过不推荐 )

如果我的回答帮助到了你,欢迎采纳,祝学习愉快~

0

0 学习 · 40143 问题

查看课程