<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录页面</title>
/*总体的样式*/
<style>
/*盒子样式*/
#box{
width: 350px; //宽
height: 450px; //高
border: 1px solid black; //边框
border-radius: 10px; //边框弧度
font-family: 黑体; //字体
letter-spacing:8px; //段间距
word-spacing: 10px; //字间距
line-height: 40px; //行高
font-size: 18px; //字大小
padding: 20px; //内边框
}
/*给'注册'赋予样式*/
.register{
width:280px ; //宽
height: 50px; //高
background-color: skyblue; //背景颜色
border-radius: 10px; //边框弧度
}
/*将所有边框都改变*/
*{
border-radius: 5px; 边框弧度
}
/*使用class选择器,赋予number宽高和边框*/
.number{
width: 185px; //宽
height: 27px; //高
border-width: 1px; //边框宽度
}
/*id选择器*/
#two{
width: 55px; //宽
border-width: 1px; 边框宽度
}
/*id选择器*/
#phone{
width: 103px; //宽
}
/*class 选择器*/
.boxs{
zoom: 75%; //清除浮动
color: darkgray; //颜色
}
/*class选择器*/
.box_a{
width: 50px; //宽
height: 50px; //高
background-image: url("../image/04.jpg "); //背景图片
background-repeat: no-repeat; // 是否平铺
background-size: 50px 25px; //背景尺寸
position: relative; //定位 相对定位
left: 310px; //定位后左移
bottom: 32px; //定位后下移
}
</style>
</head>
<body>
<div id="box">
<h1>请注册</h1>
<p style="color: darkgray">已有帐号?<a href="https://im.qq.com/index">登录</a></p>
<form action="" method="post">
<label for="name">用户名</label>
<input type="text" placeholder="请输入用户名" id="name" class="number"> <br>
<label for="phone">手机号</label>
<select name="" id="two" class="number">
<optgroup>
<option style="" class="">+86</option>
</optgroup>
</select>
<input type="text" placeholder="请输入手机号" id="phone" class="number"> <br>
<label for="mima">密 码</label>
<input type="password" placeholder="请输入密码" id="mima" class="number"> <br>
<label for="mima">验证码</label>
<input type="password" placeholder="请输入验证码" id="is" class="number">
<div class="box_a"></div>
<div class="boxs">
<input type="radio" id="" class="accept">阅读并接受协议<br>
</div>
<input type="submit" value="注册" class="register" >
</form>
</div>
</body>
</html>
在这里插入图片描述下是使用 C# 创建 HTML 文件的代码示例:
using System;
using System.IO;
namespace CreateHTMLFile
{
class Program
{
static void Main(string[] args)
{
// 设置 HTML 文件路径及文件名
string filePath = @"C:\Temp\example.html";
// 创建一个新的 HTML 文件
using (StreamWriter writer = new StreamWriter(filePath))
{
// 写入 HTML 标记
writer.WriteLine("<html>");
writer.WriteLine("<head><title>Example HTML File</title></head>");
writer.WriteLine("<body>");
// 写入主体内容
writer.WriteLine("<h1>Hello, World!</h1>");
writer.WriteLine("<p>This is an example HTML file created using C#.</p>");
// 写入 HTML 结束标记
writer.WriteLine("</body>");
writer.WriteLine("</html>");
}
// 输出成功消息
Console.WriteLine("HTML 文件已创建:{0}", filePath);
}
}
}
此代码将创建一个名为 “example.html” 的 HTML 文件,并在其中添加一些基本的元素。你可以根据需要修改或扩展它,以满足你的具体需求。注意,要创建 HTML 文件,你需要使用 System.IO 命名空间中的 StreamWriter 类。该类允许你向文件写入文本数据。
nput框作为一个简单的输入框,你对它的属性知道有多少?
常见的属性(带new为h5新增属性):
1、accept:accept 属性规定了可通过文件上传提交的服务器接受的文件类型。仅用于input的type类型为"file"的时候。
属性值:
audio/*,音频
video/* ,视频
image/* ,图片
MIME_type,一个有效的 MIME 类型,不带参数
<input type="file" name="pic" accept="image/*" />// 如需规定多个值,请使用逗号分隔
<input type="file" accept="audio/*,video/*,image/*" />2、value:指定元素的value值。
属性值:text
value 属性对于不同 input 类型,用法也不同:
注意:value 属性对于 <input type="checkbox"> 和 <input type="radio"> 是必需的。
注意:value 属性不适用于 <input type="file">。
<input value="文本" />3、name:表示的该文本输入框名称。用于表单提交后引用表单数据。只有设置了 name 属性的表单元素才能在提交表单时传递它们的值。
属性值:text
<input type="text" name="email" />4、size:输入框的长度大小。
属性值:number
<input type="text" name="email" size="35" />注意:size 属性适用于下面的 input 类型:text、search、tel、url、email 和 password。
5、maxlength:输入框中允许输入字符的最大数。
属性值:number
<input type="text" name="usrname" maxlength="10" />6、readonly:表示该框中只能显示,不能添加修改。
<input type="text" name="country" value="中国" readonly />7、required(new):属性规定必须在提交表单之前填写输入字段。
<input type="text" name="username" required />8、alt:定义图像输入的替代文本。 (只针对type="image")
属性值:text
<input type="image" src="submit.gif" alt="Submit" width="48" height="48" />9、autocomplete(new):autocomplete 属性规定输入字段是否应该启用自动完成功能。
属性值:on/off,默认启动自动完成功能。
<input autocomplete="off" />注意:autocomplete 属性适用于下面的 <input> 类型:text、search、url、tel、email、password、datepickers、range 和 color。
10、autofocus(new):属性规定当页面加载时 <input> 元素应该自动获得焦点。
属性值:autofocus
<input type="text" autofocus />11、checked:checked 属性规定在页面加载时应该被预先选定的 <input> 元素。 (只针对 type="checkbox" 或者 type="radio")
属性值:checked
<input type="checkbox" name="vehicle" value="Car" checked />小汽车12、disabled:disabled 属性规定应该禁用的 <input> 元素。
属性值:disabled
<input type="text" name="lname" disabled />13、form(new): form 属性规定 <input> 元素所属的一个或多个表单。
位于 form 表单外的输入字段(但仍然属于 form 表单的一部分):
<form action="demo-form.php" id="form1">
First name: <input type="text" name="fname"><br>
<input type="submit" value="提交">
</form>14、formaction(new):属性规定当表单提交时处理输入控件的文件的 URL。(只针对 type="submit" 和 type="image")
属性值:URL
<input type="submit" formaction="demo-admin.php" value="提交" />注意:
formaction 属性规定当表单提交时处理输入控件的文件的 URL。
formaction 属性覆盖 <form> 元素的 action 属性。
15、formenctype(new):属性规定当表单数据提交到服务器时如何编码(只适合 type="submit" 和 type="image")。
属性值:application/x-www-form-urlencoded ;multipart/form-data text/plain
<input type="submit" formenctype="multipart/form-data" value="以 Multipart/form-data 提交" />注意:
formenctype 属性规定当表单数据提交到服务器时如何编码(仅适用于 method="post" 的表单)。
formenctype 属性覆盖 <form> 元素的 enctype 属性。
16、formmethod (new):定义发送表单数据到 action URL 的 HTTP 方法。 (只适合 type="submit" 和 type="image")
属性值:get / post
<input type="submit" formmethod="post" formaction="demo-post.php" value="使用 POST 提交" />17、formnovalidate(new):formnovalidate 属性覆盖 <form> 元素的 novalidate 属性。
属性值:formnovalidate
<input type="submit" formnovalidate="formnovalidate" value="不验证提交">18、formtarget (new):规定表示提交表单后在哪里显示接收到响应的名称或关键词。(只适合 type="submit" 和 type="image")
属性值:_blank; _self; _parent; _top; framename
<input type="submit" formtarget="_blank" value="提交到一个新的页面上">19、height (new);width(new):属性规定 <input> 元素的高度和宽度。 (只针对type="image")
属性值:pixels
<input type="image" src="img_submit.gif" alt="Submit" width="48" height="48" />20、max (new);min(new):属性规定 <input> 元素的最大值和最小值。
属性值:number;date
<input type="date" name="bday" max="1979-12-31">
<input type="date" name="bday" min="2000-01-02">
<input type="number" name="quantity" min="1" max="5">21、multiple (new):属性规定允许用户输入到 <input> 元素的多个值。
属性值:multiple
<input type="file" name="img" multiple>注意:multiple 适用于以下 input 类型:email 和 file。
22、pattern (new):pattern 属性规定用于验证 <input> 元素的值的正则表达式。
属性值:regexp;
<form action="demo_form.html">
Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
<input type="submit">
</form>23、placeholder (new): 属性规定可描述输入 <input> 字段预期值的简短的提示信息 。
属性值:text
<input placeholder="请输入姓名" />24、src : src 属性规定显示为提交按钮的图像的 URL。 (只针对 type="image")
属性值:URL
<input type="image" src="submit.gif" alt="Submit" />25、step (new): step 属性规定 <input> 元素的合法数字间隔。
属性值:number
<input type="number" name="points" step="3">26、list(new) :属性引用 <datalist> 元素,其中包含 <input> 元素的预定义选项。
属性值:datalist_id
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Google Chrome">
<option value="Opera">
<option value="Safari">
</datalist>27、type: type 属性规定要显示的 <input> 元素的类型。
属性值:button;checkbox;color;date;datetime;datetime-local;email;file;hidden;image;month;number;password;radio;range;reset;search;submit;tel;text;time;url;week
type的属性值众多,也是用的比较多的一个。
button:定义可点击的按钮(通常与 JavaScript 一起使用来启动脚本)。
checkbox:定义复选框。
color(new):定义拾色器。
date(new):定义 date 控件(包括年、月、日,不包括时间)。
datetime(new):定义 date 和 time 控件(包括年、月、日、时、分、秒、几分之一秒,基于 UTC 时区)。
datetime-local(new):定义 date 和 time 控件(包括年、月、日、时、分、秒、几分之一秒,不带时区)。
email(new):定义用于 e-mail 地址的字段。file定义文件选择字段和 "浏览..." 按钮,供文件上传。
hidden:定义隐藏输入字段。
image:定义图像作为提交按钮。
month(new):定义 month 和 year 控件(不带时区)。
number(new):定义用于输入数字的字段。
password:定义密码字段(字段中的字符会被遮蔽)。
radio:定义单选按钮。
range(new):定义用于精确值不重要的输入数字的控件(比如 slider 控件)。
reset:定义重置按钮(重置所有的表单值为默认值)。
search(new):定义用于输入搜索字符串的文本字段。
submit:定义提交按钮。
tel(new):定义用于输入电话号码的字段。
text:默认。定义一个单行的文本字段(默认宽度为 20 个字符)。
time(new):定义用于输入时间的控件(不带时区)。
url(new):定义用于输入 URL 的字段。
week(new):定义 week 和 year 控件(不带时区)。
*请认真填写需求信息,我们会在24小时内与您取得联系。