Home >Web Front-end >HTML Tutorial >Powerful HTML_html/css_WEB-ITnose
HTML basic tags (1)
1. What is HTML
html: Hyper TextMakeup language: Hypertext Markup Language
html: The "source code" of the web page
Browser: a tool to "interpret and execute" the html source code
2. Summary information of the web page
The summary information of the web page is conducive to browser analysis and search Engine search:
2.1 Use the
2.2 Use tags
(1) Describe document type and character encoding
(2) Describe search keywords and description
3. Blocks and lines in HTML pages
HTML tag classification (to facilitate subsequent layout design)
Block-level labels: Displayed in a "block" shape, separated by one line before and after
Row-level labels: Displayed one by one line by line
Emphasis: The difference between block-level and row-level labels:
Block level: line breaks before and after
Row level: displayed in one line
Block-level tags are divided into: basic block-level tags, block-level tags commonly used in layout
Basic Block-level tags:
001. Title tag
...
< h6>Title
h1 is the largest, h6 is the smallest
002. Paragraph tags
...
003. Horizontal line tags
Block-level tags commonly used in layout:
001. Ordered list tags
002. Unordered list tags
003. Define description tags (commonly used for mixing images and text) Editor)
004. Use definition description tags to achieve the effect of mixed graphics and text
005. Table
Baidu | Sina |
006. Form
007. Partition tag div
Key points: Generally used as structured block elements, as logical partitions (blocks) That is, containers are used.
04. Please tell me what are the 4 block structures commonly used in actual development?
01.div-ul(ol)-li: Commonly used for category navigation or menus, etc.
02.div-dl-dt-dd: Where commonly used words are mixed with images and text
03.table-tr-td is often used for image and text layout or data display
04.form-table-tr-td: Commonly used for layout forms
05. Row-level tags
001, image tags
For compatibility between browsers, it is recommended to use the title attribute to ensure that the prompt text can be displayed
alt: When the picture is not When displayed, the text displayed on the picture
title: The text displayed on the picture when the mouse is over
002. Row-level label : Displays the unique style in a certain line
Text and other line-level content
003. Line break tags
06. Why is w3c needed? Standards
w3c: World Wide Web Consortium, World Wide Web Consortium
W3C’s functions: Responsible for formulating and maintaining web industry standards
Web structure advocated by W3C:
1. Separation of content (structure) and presentation (style)
2. HTML content structure requires semantics
07.XHTML1.0 basic specification
001. Tag name and Attribute names must be lowercase
002.html tags must be closed
003. Attribute values must be enclosed in quotes
004. Tags must be nested correctly
005. A document type declaration must be added
The document declaration must be at the front of the document. There are three levels: Strict (strict type), Transitional (transitional type), Frameset (frame type)
Basic HTML tags (2)
01. Hyperlink--implementing navigation between pages
Syntax: Link hot text or image
For example:
02. Relative Path: relative to the address of the current directory, commonly used
Absolute path: pointing to the complete target address Description, use sparingly
Important: If you want to access the upper-level path of the current path, you can use ../
03.Super Three application scenarios of links
001. Links between pages
002. Anchor links
003. Functional links
001. Links between pages
Applicable occasions: commonly used in website navigation
002. Implement anchors Links (divided into same-page anchor links and inter-page anchor links)
Same-page anchor links:
1. Define tag (anchor): Target position
2. Set the link to the mark position: Current position
Applicable occasions: Applicable When the page content is large and exceeds one screen
Cross-page link:
1. The page where the tag is located: [Celebrity Area]< /a>
Anchor links can be used on the same page or across pages
2. Set the link to the tag position: star Special area
003. Functional links
E-mail, QQ links, etc.
To be written...
04. Comments
The commented lines are used to increase the readability of the code and are not displayed
05. Special symbols
Space:
Greater than: >
Less than: <
Quotation marks ("): "
Copyright number (): ©
Because <, > and other symbols have been used in HTML, they must be replaced by other symbols, all ending with ;
06. Common form elements
Single-line text box (text)
Password box (password)
Text area (textarea)
Radio button(radio)
Checkbox(checkbox)
Submit button(submit)
Drop-down list(select)
< ;select>
Reset button (reset)
07. Basic syntax of the form
action: Specify which handler on the server will handle it after submission
method : Specify the method to submit to the server: generally the post or get method, the post method is safer.
08. The execution principle of the form
Client: request login, fill in the account information through the form
The client and the server are like two people communicating, thus establishing interactive activities
Server side: Verify the account information sent and give feedback!
09. Basic format of form elements
10. Introduction of form elements one by one
Text box
name is used to obtain data on the server side, for example: request.getParameter("userName")
Password box
Button
Normal button: button
Submit button: submit
Reset ( Clear) button: reset
Image button: image
Radio button
The same name indicates that they belong to the same group
Features: Single selection
Checkbox
Features: Multiple selection
File field
Example:
< /select>
Function: Provide fixed options to avoid user input errors
Multi-line text box
Text content
Hidden field
It is convenient for the server to "remember" the client's information. Data that you don’t want customers to see
Read-only and disabled attributes
readonly: I hope that the content in a certain box can only be viewed by users and cannot be modified
disabled: Users are restricted from using it because the conditions for use are not met
Welcome to the Terms of Service Agreement, Guimei’s rights and obligations
Agree to the above agreement
< input name="btn" type="submit" value="Register" disabled="disabled"/>
Table application and layout
1. Why use sheet?
Common applications of forms:
01 Forum
02. Shopping website
03. Portal application form
2. The basic structure of the table
Rows, columns and cells
Features: Normally, the height of the same row is the same and the width of the same column is the same
3. Basic syntax of tables
Baidu td> | Sina |
56网 |
How to create a table?
Chinese td>
| 98 | 95 |
Among them, the colspan attribute indicates how many columns it spans
The content of other cells in the row is omitted
The rowspan attribute indicates how many rows it spans
5. Table advanced tags
Table title:
Header:
Header: Data subject:
Implementation steps:
01. Determine the number of rows and columns: 5 rows and 2 columns
02, write a table with 5 rows and 2 columns
03, determine the span of rows Cells spanning columns:
1 row and 1 column cells span 2 columns
2 rows and 1 column cells span 4 rows
04. Add rowspan and colspan to delete redundant ones Cell,
7. How to implement form layout?
What are the requirements for displaying data using tables for layout? What is the implementation idea?
Usage occasions: The data display requirements are regular and consistent with the characteristics of table layout
Layout implementation ideas:
01. How many rows and columns of tables are needed?
02. Which cells span rows or columns?
03. Write table code to implement
Note: 1. The width of cells in the same column is determined by the cell with the largest width in the column
2. Same row The cell width is determined by the cell with the highest height in the row
8. Nested layout
Disadvantages of nested table layout:
01, The amount of code is large
02, and the hierarchical structure is relatively complex
03, which is not conducive to searching for data with search engines such as Google
9. Applicable occasions for table layout:
01, regular data display
02, form page
Tip: Table layout is not suitable for irregular and complex pages. In this case,
needs to use DIV CSS layout
Framework
1. Why use frames?
Two types of uses of frames:
01. Display multi-window pages--use
02. Set the target attribute of (window subpage)
Set the link to open in the right window
Other uses of target:
In a new window Displayed in: _blank
Displayed in self window: _self
Displayed in parent window: _top
Displayed in parent window: _parent
3. Why use
01.
02. Embedding is more flexible and can be used on web pages Use anywhere
03. Can be used as a template to reuse on multiple pages of this website
Basic usage of iframe
Common attributes
How to set the display in the inline window
The third page is displayed below
例子:
Li
{
Color:red;
Font-size:30px;
Font-family:隶书;
}
3.选择器的分类
选择器分为:标签选择器、类选择器、ID选择器(重点)
Li{
Color:red;
Font-size:28px;
Font-family:隶书;
}
作用:用于修饰同类HTML标签的共同风格
.blue{color:blue;}
……
……
注意:类名有点号
#menu{
width:200px; background:#ccc;
font:bold 14px 宋体;
}
… …
4.文本属性
字体、字号:
Font(缩写形式)
Font-weight(粗细)
Font-size(大小)
Font-family(字体)
行距、对齐等:
Line-height(行高)
Text-align(对齐)
Letter-spacing(字符间距) 我 是
Text-decoration(文本修饰)
White-space(空白处理) 属性值:nowrap:不换行
li{
font: 12px 宋体;
text-align:left;
line-height:28px;
}
.title{
letter-spacing:5px;
white-space:nowrap;
text-decoration:underline;
}
.bigFont {
font-size:16px;
color:red;
}
5.背景属性
div{
background:url(images/bg.jpg) no-repeat;
background-position: -70px -60px
}
6 .背景属性的经典应用
图标截取-背景偏移量技术:理解清楚是左移还是右移,然后设置div的宽度和高度以适应图片的显示。
div{
width:20px;background:url(images/icon.gif) no-repeat;
float:left;
}
.help{
background-position:-120px 0px;
}
.login{
width:40px;background-position:0px -20px;
}
购 物 车
帮助中心
7. List attributes
01. List li common attributes
List-style (list style) value
Attribute value Method Grammar rules Example
None Style List-style: none; Brush Teethdisc solid circle(< ul>Default type) list-style:disc; ●brush your teeth
circle hollow circle list-style:circle; ○ brush your teeth
square solid square list-style :square; ■ Brush your teeth
decimal Number (
Table common attributes
Background color;
color: text color
border-style: solid; border style, solid line (default is none), and dotted (point) and other values;
border-color: border color;
border-width: border width (default is 0)
CSS style sheet (2)
1. How to control CSS style
The box model includes:
Element content
Filling ( Also called inner margin): padding
Border: border
Border (also called outer margin): margin
Box position layout: determine the location of the box and its relationship with other web elements
2. Detailed explanation of the box model
2. The box attribute is the key attribute of the box model
Each attribute is divided into For four directions
Margin-top
Margin-right
Margin-bottom
Margin-left
Margin:1px, 2px, 3px, 4px; (Each value is: top, right, bottom, left, clockwise)
Margin: value 1, value 2, value 3; (Meaning: value 1 for top, value for left and right 2, the bottom is the value 3)
Margin:1px,2px; (Meaning: the upper and lower values are 1, the left and right values are 2)
Margin:0 auto; equivalent to margin:0 auto 0 auto; that is, the top and bottom are 0, the left and right are automatic, and the HTTP header protocol is required to display in the center
Margin: value 1; (meaning: the top, right, bottom, and left are all value 1)
Margin- left:1px;
Border(border)
Modification attributes:
Border-color
Border-width
Border-style
Four directions:
🎜>
Border -left
Typical applications
Border-style:none;
Border:1px solid red;
Border-right:5px dotted blue;
(solid line, dashed dotted point)
Use the border attribute to modify the form
. textBorder{
Border-width:1px;
Border-style:solid;
}