请问对吗?
来源:3-12 编程练习
qq_慕先生3429672
2020-04-29 17:16:56
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>可设置宽和高的元素</title>
<style type="text/css">
div{ width:600px;height:200px;border:1px solid gray;font-size:14px;}
/*补充样式*/
p{width:30%;font-size:2em}
span{width:30%;height:25%;}
.input{width:100px;height:30px;background-color:orange;font-size:20px;}
</style>
</head>
<body>
<div>
<p>登录</p>
<span>请输入您的信息:</span><input type="text" class="input"><br>
<input type="submit" class="sub">
</div>
</body>
</html>
3回答
好帮手慕码
2020-05-05
同学你好,代码中问题如下,多余的符号:
其他效果正确。另,因为span是行内块元素,所以设置宽高是不生效的。
祝学习愉快~
好帮手慕码
2020-04-29
同学你好,“qq_慕无忌5353450”的提示是正确的,更加符合编程要求:
祝学习愉快~
qq_慕无忌5353450
2020-04-29
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>可设置宽和高的元素</title>
<style type="text/css">
div{ width:600px;height:200px;border:1px solid gray;font-size:14px;}
/*补充样式*/
p{width:30%;font-size:2em;}
.input{width:30%;height:25%;}
.sub{width:100px;height:30px;background-color:orange;font-size:20px;}
span{width:600px;}
</style>
</head>
<body>
<div>
<p>登录</p>
<span>请输入您的信息:</span><input type="text" class="input"><br>
<input type="submit" class="sub">
</div>
</body>
</html>
不一定对,仅供参考。是给提交按钮设置颜色吧。