如何让一个html+css小white写出一个“注册”网页

1 篇文章 0 订阅

(注:此网站仅供学习,娱乐,没有用于盈利,商业用途,没有冒犯百度的意思!)

还是先展示出结果样式供观看:

步骤 1: 创建基本结构

1. 创建一个新的HTML文档,使用`<!DOCTYPE html>`声明。
2. 在`<html>`标签内,添加一个`<head>`部分,包括字符集声明`<meta charset="utf-8">`和网页标题`<title>`。
3. 在`<body>`标签内,创建一个`<form>`元素,用于包含注册表单的内容。


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>注册页面</title>
</head>
<body>
    <form>
        <!-- 此处将添加表单内容 -->
    </form>
</body>
</html>

步骤 2: 创建表单结构

4. 在`<form>`元素内,使用`<label>`标签为每个表单字段添加标签,并使用`for`属性将标签与相应的表单元素关联。
5. 使用`<input>`标签创建各种表单元素,如文本框、密码框和提交按钮。为每个表单元素设置唯一的`id`属性以便与`label`标签关联。
6. 为表单元素添加`name`属性,以便在后端处理表单数据时能够识别每个字段。


<form>
    <label for="username">用户名:</label>
    <input type="text" id="username" name="username">
    
    <label for="password">密码:</label>
    <input type="password" id="password" name="password">
    
    <label for="email">邮箱:</label>
    <input type="email" id="email" name="email">
    
    <input type="submit" value="注册">
</form>

步骤 3: 样式美化

7. 在`<head>`标签内的`<style>`部分中,添加CSS规则以美化表单和表单元素。这包括背景颜色、边框、字体等。

css
label {
    display: block;
    margin-bottom: 10px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 10px;
}

input[type="submit"] {
    background-color: #3F89EC;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
}

最后将结构和样式结合,展示出完整代码,仅供参考,请勿抄袭!

(曾经有个id叫“伍925”的用户抄袭我的作品,导致下架删除,以儆效尤!!!!)
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>注册页面</title>
		<style type="text/css">
			body {
				background-image: url(img/1.jpg);
				background-size: cover;
			}

			table {
				margin: 8px auto;
				height: 500px;
				width: 550px;
				background-color: white;
				border-radius: 15px;
				border: none;
				border-collapse: collapse;
				margin-top: 190px;
				margin-right: 150px;
				opacity: 0.9;
			}

			td {
				border: none;
				padding-left: 40px;
				/* 移除表格边框 */
			}

			td:first-child {
				padding-right: 20px;
				/* Adjust the padding for the first column */
			}

			.input {
				height: 40px;
				width: 200px;
				border-radius: 4px;
				border: 1px solid #ccc;
			}

			.input:focus {
				outline: 1px solid #2E58FF;
			}

			.btn {
				height: 50px;
				width: 399px;
				color: white;
				background-color: #3F89EC;
				border-radius: 25px;
				border: 1px solid #3F89EC;
			}

			.send-btn {
				width: 125px;
				height: 40px;
				background-color: #fff;
				color: #333;
				border: 1px solid #ccc;
				border-radius: 4px;
			}

			.send-btn:hover {
				border-color: #3F89EC;
				color: #3F89EC;
				cursor: pointer;
			}

			.td-center {
				text-align: center;
			}

			#zhuce1 {
				font-size: 40px;
				font-weight: 600;
			}
		</style>
	</head>
	<body>
		<table>
			<tr>
				<td colspan="2">
					<div id="zhuce1">欢迎注册</div>
				</td>
			</tr>
			<tr>
				<td colspan="2">已有账号? <a href="https://passport.baidu.com/v2/?login">登录</a></td>
			</tr>
			<tr>
				<td><label for="username">用户名</label></td>
				<td><input class="input" id="username" type="text" placeholder="请输入账户" /></td>
			</tr>
			<tr>
				<td><label for="phone">手机号</label></td>
				<td><input class="input" id="phone" type="text" placeholder="请输入手机号" /></td>
			</tr>
			<tr>
				<td><label for="pwd">密码</label></td>
				<td><input class="input" id="pwd" type="text" placeholder="请输入密码" /></td>
			</tr>
			<tr>
				<td><label for="code">验证码</label></td>
				<td>
					<input class="input" id="code" type="text" placeholder="请输入验证码" />
					<input class="send-btn" type="button" value="获取验证码" />
				</td>
			</tr>
			<tr>
				<td class="td-center" colspan="2"><input class="btn" type="button" value="注册" /></td>
			</tr>
			<tr>
				<td class="td-center" colspan="2">
					<input id="txt" type="checkbox" />
					<label for="txt">阅读并接受 <a
							href="https://passport.baidu.com/static/passpc-account/html/protocal.html">《百度用户协议》</a>、<a
							href="https://www.gov.cn/xinwen/2019-08/23/content_5423865.htm#:~">《儿童个人信息保护声明》</a>及 <a
							href="https://www.baidu.com/duty/yinsiquan.html">《百度隐私权保护声明》</a></label>
				</td>
			</tr>
		</table>
	</body>
</html>

好的,请参考以下代码实现一个完整的轮播图: HTML: ```html <div class="slideshow-container"> <img src="image1.jpg" class="slides"> <img src="image2.jpg" class="slides"> <img src="image3.jpg" class="slides"> <a class="prev" onclick="plusSlides(-1)">❮</a> <a class="next" onclick="plusSlides(1)">❯</a> </div> ``` CSS: ```css .slideshow-container { max-width: 800px; position: relative; margin: auto; } .slides { width: 100%; height: auto; display: none; position: absolute; top: 0; left: 0; } .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; } .next { right: 0; border-radius: 3px 0 0 3px; } .prev:hover, .next:hover { background-color: rgba(0,0,0,0.8); } .dot-container { text-align: center; margin-top: 20px; } .dot { cursor: pointer; height: 15px; width: 15px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .active, .dot:hover { background-color: #717171; } .fade { animation-name: fade; animation-duration: 1.5s; } @keyframes fade { from {opacity: .4} to {opacity: 1} } ``` JavaScript: ```javascript var slideIndex = 1; showSlides(slideIndex); function plusSlides(n) { showSlides(slideIndex += n); } function currentSlide(n) { showSlides(slideIndex = n); } function showSlides(n) { var i; var slides = document.getElementsByClassName("slides"); var dots = document.getElementsByClassName("dot"); if (n > slides.length) {slideIndex = 1} if (n < 1) {slideIndex = slides.length} for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } slides[slideIndex-1].style.display = "block"; dots[slideIndex-1].className += " active"; } ``` 这样就完成了一个基本的轮播图,可以通过 CSS 文件中的样式调整轮播图的样式,通过 JavaScript 文件中的代码修改轮播图的功能。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值