Table of Contents
Effect overview:
Specific code implementation
Code analysis
Document type declaration
HTML<style>tag
HTML<FieldSet>tag
Home Web Front-end HTML Tutorial How to use html and css to implement a simple example of registration form

How to use html and css to implement a simple example of registration form

Jul 24, 2017 am 10:24 AM
css html

Effect overview:


Specific code implementation

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;提交用户信息&lt;/title&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;style&gt;
body, p, td, input {font-size:12px; margin:0px; }
select {height:20px; width:300px; }
.title {font-size: 16px; padding: 10px; width:80%; }
.text {height:20px; width:300px; border:1px solid #AAAAAA; }
.line {margin:2px; }
.leftp {width:110px; float:left; height:22px; line-height:22px; font-weight:bold; }
.rightp {height:42px; }
.button {
color:#fff;
font-weight:bold;
font-size: 11px; 
text-align:center;
padding:.17em 0 .2em .17em;
border-style:solid;
border-width:1px;
border-color:#9cf #159 #159 #9cf;
background:#69c url(images/bg-btn-blue.gif) repeat-x;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form action=&quot;/servlet/servlet/PostServlet&quot; method=&quot;POST&quot;&gt;
&lt;p align=&quot;center&quot;&gt;
&lt;br/&gt;
&lt;fieldset style=&#39;width:90%&#39;&gt;
&lt;legend&gt;填写用户信息&lt;/legend&gt;
&lt;br/&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请填写您的姓名:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;text&quot; /&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请填写您的密码:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;password&quot; name=&quot;password&quot; class=&quot;text&quot; /&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请再次输入密码:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;password&quot; name=&quot;passwordConfirm&quot; class=&quot;text&quot; /&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请选择性别:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;radio&quot; name=&quot;sex&quot; value=&quot;男&quot; id=&quot;sexMale&quot;&gt;
&lt;label for=&quot;sexMale&quot;&gt;男&lt;/label&gt;
&lt;input type=&quot;radio&quot; name=&quot;sex&quot; value=&quot;女&quot; id=&quot;sexFemale&quot;&gt;
&lt;label for=&quot;sexFemale&quot;&gt;女&lt;/label&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请输入年龄:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;text&quot; name=&quot;age&quot; class=&quot;text&quot;&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请输入生日:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;text&quot; name=&quot;birthday&quot; class=&quot;text&quot;&gt; 
&lt;br/&gt;格式:&quot;yyyy-mm-dd&quot;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请选择您的爱好&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;interesting&quot; value=&quot;音乐影视&quot; id=&quot;i1&quot;&gt;
&lt;label for=&quot;i1&quot;&gt;音乐影视&lt;/label&gt; 
&lt;input type=&quot;checkbox&quot; name=&quot;interesting&quot; value=&quot;外出旅游&quot; id=&quot;i2&quot;&gt;
&lt;label for=&quot;i2&quot;&gt;外出旅游&lt;/label&gt; 
&lt;input type=&quot;checkbox&quot; name=&quot;interesting&quot; value=&quot;社交活动&quot; id=&quot;i3&quot;&gt;
&lt;label for=&quot;i3&quot;&gt;社交活动&lt;/label&gt; 
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;请选择省市:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;select name=&quot;area&quot;&gt;
&lt;option&gt;---请选择省份---&lt;/option&gt;
&lt;optgroup label=&quot;北京市&quot;&gt;
&lt;option value=&quot;北京市海淀区&quot;&gt;海淀区&lt;/option&gt;
&lt;option value=&quot;北京市朝阳区&quot;&gt;朝阳区&lt;/option&gt;
&lt;option value=&quot;北京市东城区&quot;&gt;东城区&lt;/option&gt;
&lt;option value=&quot;北京市西城区&quot;&gt;西城区&lt;/option&gt;
&lt;/optgroup&gt;
&lt;optgroup label=&quot;山东省&quot;&gt;
&lt;option value=&quot;山东省济南市&quot;&gt;济南市&lt;/option&gt;
&lt;option value=&quot;山东省青岛市&quot;&gt;青岛市&lt;/option&gt;
&lt;option value=&quot;山东省潍坊市&quot;&gt;潍坊市&lt;/option&gt;
&lt;/optgroup&gt;
&lt;/select&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;自我描述:&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;textarea name=&quot;description&quot; rows=&quot;4&quot; style=&quot;width:300px; &quot;&gt;请填写其他资料... &lt;/textarea&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;br/&gt;
&lt;p class=&#39;line&#39;&gt;
&lt;p align=&quot;left&quot; class=&#39;leftp&#39;&gt;&lt;/p&gt;
&lt;p align=&quot;left&quot; class=&#39;rightp&#39;&gt;
&lt;br/&gt;&lt;input type=&quot;submit&quot; name=&quot;btn&quot; value=&quot; 提交信息 &quot; class=&quot;button&quot;&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;/fieldset&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy after login

Code analysis

Document type declaration

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
Copy after login

This code is called the DOCTYPE statement. DOCTYPE is the abbreviation of document type and is used to indicate what version of XHTML or HTML you are using. This indicates that you are using the "HTML 4.01" version. Similar ones are:

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
Copy after login


This declares that this document uses the XHTML 1.0 version.

HTML<style>tag

<style> tag defines styles in the document.

If you need to reference a style sheet in the document, you should define an external style sheet and then use <link> to connect to the style sheet.


Tips: In HTML5, all elements do not support the style attribute. If you need to add a style to an element, please Use the scoped attribute in the style element.

Note: If the scoped attribute is not defined, the <style> element must be a child element of the head element, or a child element of the noscript element (which is a child element of the head element) .


&lt;head&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    h1 {color: blue}
    h2 {color: red}
    &lt;/style&gt;
&lt;/head&gt;
Copy after login

HTML<FieldSet>tag

  • HTML legend tag

If a There are too many form items on the page. We'd better display them in groups, just like using the p tag to separate paragraphs. You can use the fieldset and legend tags to separate the form. Content grouping.

fieldset tag--Group the form


  • ##fieldset tags appear in pairs , starting with &lt;fieldset&gt; and ending with </fieldset>

  • ##A form can have multiple
  • &lt ;fieldset>

    , each pair of &lt;fieldset&gt; is a group, and the description of each group of content can use the legend tag to describe the

    ## attribute:
  • Common -- General attributes

The above is the detailed content of How to use html and css to implement a simple example of registration form. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

Nested Table in HTML

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Table Border in HTML

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

HTML margin-left

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

HTML Table Layout

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Moving Text in HTML

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

HTML Ordered List

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

HTML onclick Button

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

How do you parse and process HTML/XML in PHP?

See all articles