<!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小時內與您取得聯系。