复习题(1)

更新时间: 试题数量: 购买人数: 提供作者:

有效期: 个月

章节介绍: 共有个章节

收藏
搜索
题库预览
请编写HTML和CSS代码,其效果图如下。 注:第一行的警告图片是images文件夹中warning.gif,Username和Password输入框分别使用img文件夹中的username.gif图片和password.gif图片。所有标签中的字号大小为12px,且所有元素之间的上下间距为8px,输入框中的文字,只能紧贴图片后输入,“会员登录”提交按钮离网页左边的距离为60px且背景图片为images文件夹中logining.gif。logining.gif图片宽高是70*21像素,username.gif、password.gif、warning.gif图片宽高都是16px,所有图片使用CSS代码设置为对应标签的背景图片。 参考代码如下: <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style> label{ display: block; font-size: 12px; font-weight: 900; margin:8px ; } h3{ background: url("images/warning.gif") no-repeat; padding-left: 18px; } #username{ background: url("images/username.gif") no-repeat; padding-left: 18px; } #password{ background: url("images/password.gif") no-repeat; padding-left: 18px; } a{ display: block; margin:8px ; text-decoration: none; color:orange; } .submit{ background: url("images/logining.gif") no-repeat; display: block; width:71px; height: 21px; line-height: 13px; cursor: pointer; margin-left:50px; border-radius: 5px; } </style> </head> <body> <div id="sidebar"> <h3>请输入登录的用户名和密码</h3> <form method="post" action="index.html"> <label for="username">Username</label> <input type="text" class="text username" id="username" name="username" /> <label for="password">Password</label> <input type="password" class="text password" id="password" name="password" /> <a href="###">Get your Password?</a> <input type="submit" class="submit" value="###" /> </form> </div> </body> </html>
请使用HTML和CSS编写一个简单的用户注册表单页面。要求如下: 1. HTML部分要求:使用<form>标签创建表单。 包含以下控件:用户名:文本输入框。密码:密码输入框。性别:单选按钮(男、女)。兴趣:复选框(阅读、运动、旅游)。城市:下拉选择框(北京、上海、广州)。注册:提交按钮。所有输入框前必须使用<label>标签标注。 2. CSS部分要求: 必须使用外部CSS。必须使用id选择器(至少1个)和class选择器(至少1个)。设置页面背景色为浅灰色(#f0f0f0)。设置输入框(文本、密码、下拉框)的边框为1像素灰色实线。设置提交按钮的背景色为蓝色,并在鼠标悬停时变深。 参考代码如下: <!DOCTYPE html> <html> <head> <title>注册页面</title> <!-- 引入CSS --> <link rel="stylesheet" href="style.css"> </head> <body> <!-- 使用id选择器 --> <div id="box"> <h3>会员注册</h3> <form> <!-- 使用class选择器统一宽度 --> <label>用户名:</label> <input type="text" class="input"><br><br> <label>密码:</label> <input type="password" class="input"><br><br> <label>性别:</label> <input type="radio" name="sex">男 <input type="radio" name="sex">女<br><br> <label>兴趣:</label> <input type="checkbox">阅读 <input type="checkbox">运动 <input type="checkbox">旅游<br><br> <label>城市:</label> <select class="input"> <option>北京</option> <option>上海</option> <option>广州</option> </select><br><br> <!-- 使用id选择器设置按钮 --> <input type="submit" id="btn" value="注册"> </form> </div> </body> </html> /* 1. 页面背景(基础选择器)*/ body { background-color: #f0f0f0; } /* 2. id选择器:定义盒子样式 */ #box { width: 300px; margin: 50px auto; padding: 20px; background: white; border: 1px solid #ddd; } /* 3. class选择器:统一输入框样式 */ .input { width: 200px; padding: 5px; border: 1px solid #999; /* 要求的边框样式 */ } /* 4. id选择器:按钮样式 */ #btn { padding: 8px 16px; background-color: #007BFF; /* 蓝色背景 */ color: white; border: none; cursor: pointer; }