Website update: www.dadaqianduan.cn/#/%E5%89%8D…
Web page creation basics
Note: As a learning aid only
So what can Web page creation basics teach you?
Section 1: Mastering Web basics.
Section two: Basic knowledge of HTML.
Section 3 Basic knowledge of the CSS.
Web Development Background
- The concept of computer language
- Interpretation and compilation
- The introduction of Sublime does
- Introduction to Developer Tools
- Naming conventions
Naming conventions
- The English name
- Numbers should not start
- Hump nomenclature
Learn front-end contact with web basic languages, HTML, CSS, JavaScript
Web Basics
Read for 15 minutes each time:
Internet
Internet Internet in Chinese.- It is a global network of computers that communicate with each other in a common language.
WWW
isWorld Wide Web
The Abbreviation of the Chinese name world Wide Web.WWW
isInternet
The most important part of.- It is a
Internet
On those who supportWWW
Services andHTTP
A collection of servers for the protocol. WWW
In use is divided intoWeb
The client andWeb
The service side.- Users can use
Web
Client accessWeb
Pages on the server. Website
, the Chinese name for website, refers to inInternet
On according to certain rules, useHTML
A collection of related web pages created to display specific content.URL
, it isUniform Resource Locator
The abbreviation, The Chinese name is unified resource locator, commonly known as the website, it is a concise expression of the location and access method of resources that can be obtained from the Internet, is the address of the standard resources on the Internet.
General format of URL:
Protocol :// Host IP address + directory path + ParametersCopy the code
Common protocols are:
A. FTP: File Transfer Protocol. You can access files on the server through FTP. Generally, the host address is preceded by username: password @.
Example:
Url: ftp://admin:[email protected]/html.pdfCopy the code
B. file: mainly accesses files on the local computer.
C. Telent: Allows users to communicate with a remote device through a negotiation process.
HTTP: Hyper Text Transfer Protocol HTTP: Hyper Text Transfer Protocol HTTP: Hyper Text Transfer Protocol
Web Standard
(Web
Standard) isWeb
Standards that application development needs to adhere to.- Web page mainly consists of three parts: structure standard, performance standard, behavior standard.
Website Access Process
Url Uniform resource locator
The addresses of standard resources on the Internet, the locations and access methods of resources available on the Internet.
Components: protocol, server address, resource path.
Web Browser
Web browser, in Chinese, is a software that displays HTML files in a web server or archive system and lets users interact with these files.Web Server
, web server in Chinese,WEB
Server, mainly to provide online information browsing services.
The Web server can parse THE HTTP protocol. When the Web server receives an HTTP request, it returns an HTTP response. The client can obtain the HTML, including CSS, JS, video, and audio, from the server.
web
Development is mainly divided into front-end and back-end two parts.- The front end is the web page that is directly in contact with the user
html,js,css
And so on. - The back-end refers to the application, database, and server levels
Web system development process
Project proposal, requirement analysis, (design, UI design, system design), (development, front-end development, background development), system testing, development and maintenance.
HTML Basics
- History of HTML: HTML, XHTML
- HTML global properties: global standard properties, global event properties
- HTML elements:
- Markup language is a type of computer coding that combines text and other text-related information to reveal details about document structure and data processing.
- HTML, for hypertext markup language.
XHTML
Is extensible hypertext Markup language, is a purer, stricter, more normativehtml
The code.html
A file consists of a header and a body.- Label classification: double label, single label.
Double label: Consists of start label and end label. It must be used in pairs and properly nested.
Single tag: Close the start tag (end at the end of the start tag).
HTML global standard attributes
In HTML, eight global standard attributes are specified.
class
The name of the class used to define the element.id
Used to specify the uniqueness of the elementid
.style
Used to specify the inline style of the element.title
Additional information for specifying elements.accesskey
Use to specify the shortcut key for activating an element.
Elements that support the accesskey attribute are ,
,
tabindex
Used to specify the element intab
The order of the keys.
,
dir
Used to specify the text direction of the content in the element.
There are only LTR and RTL values for dir, which are left to right and right to left respectively.
lang
The language used to specify the content of the element.
HTML global event properties
Window
Window events
onload
Is triggered after the page has finished loading.onunload
Triggered when the user leaves the page, such as clicking to jump, reloading the page, closing the browser window, etc.
Form
Form events
onblur
Emitted when an element loses focus.onchange
Emitted when the element’s element value is changed.onfocus
Emitted when the element gains focus.onreset
Triggered when the reload button in the form is clicked.onselect
Emitted when the element text is selected.onsubmit
Triggered when the form is submitted.
Keyboard
Keyboard events
onkeydown
Triggered when the user presses a key.onkeypress
, triggered when the user presses the key.
This property does not apply to all keys, such as Alt, CTRL, Shift, and ESC.
onkeyup
Triggered when the user releases the key.
Mouse
Mouse events
onclick
Triggered when the mouse is clicked on the element.ondblclick
Triggered when you double-click on an element.onmousedown
Triggered when the mouse button is pressed on the element.onmousemove
Event occurs when the mouse pointer moves.onmouseout
Triggered when the mouse pointer moves out of the element.onmouseover
Event occurs when the mouse pointer moves over the specified element.onmouseup
Triggered when the mouse button is released on the element.
Media Events
onabort
Triggered when exiting the media player.onwaiting
Triggered when the media has stopped playing but intends to continue playing.
The HTML element
The tags contained in an HTML document
<! DOCTYPE>
Declare the document type.<html>
, the true root of the HTML element.<head>
To definehtml
The document header of the document.
The element contained in the head, title, defines the title base of the HTML document, specifies the default address or default target link for all links on the page, defines the relationship between the document and external resources, meta, provides metadata style about the HTML, Used to define style information scripts for HTML documents, used to define client-side scriptsCopy the code
body
To definehtml
The body of a document.content-Type
, which is used to set the character set of a web page to facilitate the browser to parse and render the page.
Code:
<meta http-equiv="content-Type` content="text/html"; charset=utf-8">
Copy the code
cache-control
, which tells the browser how to cache a response and for how long.
Parameters:
No-cache: sends a request to the server to confirm whether the resource has been changed. If not, use the cache no-store to allow caching. Download the complete response from the server each time. <meta http-equiv=cache-control" content="no-cache">Copy the code
expires
, which is used to set the expiration time of the web page. After the expiration time, the web page is re-transmitted to the server.refresh
, the page will automatically refresh and redirect to the specified url within the specified timeSet-Cookie
To set the expiration of a web page.- Non-semantic elements:
<span>,<div>
.<span>
Inline tag, used in a line of text,<div>
It is a block-level label.
DIV+CSS
Div is used to store the data to be displayed, and CSS is used to specify how to display the data style, separating structure from style.
View div+ CSS style HTML: Click the link below to jump, you can view the source code:
div-css.html
Formatting element
- Plain text
<b>
, define bold text<big>
, define large words<em>
Definition focuses on words<i>
, define italics<small>
, define small words<strong>
, define the emphatic mood<sub>
, define the subscript<sup>
, define superscript words<ins>
, define the insert word<del>
, define the delete word
- Computer output
<code>
Define the computer code<kbd>
To define the keyboard output style<samp>
, define computer code samples<tt>
To define typewriter input styles<pre>
, define preformatted text
- The term
<abbr>
, define abbreviations<acronym>
, define acronyms<address>
, define address<bdo>
, define text direction<blockquote>
Defining long references<q>
Define short quotations<cite>
, define quote, quote<dfn>
Define a concept, project
Image element
<img SRC =" image url" Alt =" image substitute text ">Copy the code
Hyperlinked element
<a>
Of the labeltarget
Property, the default value is_self
.
value | instructions |
---|---|
_self |
Open the target page in the frame or window of the hyperlink |
_blank |
Open the target page in a new browser window |
_parent |
Load the target page into the parent frameset or parent window that contains the link frame |
_top |
The target page opens in the current entire browser window, so all frames are removed |
- Text links are
<a></a>
The element content between the tags is the text content. - Anchor point links are used
#+ corresponding anchor point
, anchor points usually have unique attribute valuesid
Setting.
Image hotspots link
Image hotspot links, what are they? When you look at some shopping web pages, a picture, you can link to different target locations in different places, click on different places to jump to different web pages, which is generally used to do mall projects.
Instead of a tag element, this is a
element.
The
element has two shape, records properties.
shape attribute |
instructions | cords attribute |
instructions |
---|---|---|---|
circle |
circular | x,y,r | (x,y) is the center coordinate, and r is the radius |
rect |
rectangular | x1,y1; x2,y2 | (x1,y1) is the upper-left coordinate, and (x2,y2) is the lower-right coordinate |
poly |
polygon | x1,y1; x2,y2; x3,y3; . | These are the coordinates of each point |
coordinate system, the origin is the upper left corner of the image, X-axis positive direction to the right, Y-axis positive direction downward
The use of image hotlinks. The
The
Associate the USEMAP attribute of the < IMG > tag with the name attribute of the
To prove that I’ve learned, LET me write an HTML page.
map -> name="image_link"
img -> usemap="#image_link"
Copy the code
Click to jump to: imgmap.html
E-mail link
Email links are mainly to see a lot of official web pages need to do one to open a new email.
Click the link below to see the effect:
Contact us
Code:
<a href="mailto:[email protected]">Copy the code
Javascript links
Click on the JavaScript link:
Click the popup window
Code:
<a href="javascript:alert(' Ha ha, you clicked! ');" > Click popover </a>Copy the code
Null links
- An empty link is a hyperlink that has no target address assigned.
Empty link code:
javascript: void(0)
<a href=""></a>
<a href="#"></a>
<a href="javascript:void(0)"></a>
Copy the code
List elements
To integrate a list of HTML pages, click to jump to: ul-ol.html
- Unordered list,
<ul>
Define an unordered list,<li>
Define list items.
-
type attribute values: disc point, square square, circle, None None.
- Ordered list,
<ol>
Define an ordered list,<li>
Define list items.
< OL > Type attribute values: numbers, uppercase letters, uppercase Roman numerals, lowercase letters, lowercase Roman numerals.
The start attribute defines the start position of the sequence number.
- Define a list
<dl>
Defines that a list can have multiple list item headings inside the list<dt>
Tag definition, list item title inside can have multiple list item description, with<dd>
Tag definition.
form
To integrate tabular HTML pages, click to jump to: table.html
<table>
Define the form<caption>
Defining table titles<tr>
Define several lines<td>
Define several cells<th>
Define the header- Table divided into head, body and bottom:
<thead>,<tbody>,<tfoot>
Three tags.
attribute | instructions |
---|---|
border |
Sets the border width of the table |
width |
Set the table width |
height |
Set the height of the table |
cellpadding |
Set the inside margin |
cellspacing |
Set margins |
<td>
Two properties of:colspan
Used to define cell rows,rowspan
Used to define cell span columns<tbody>,<thead>,<tfoot>
Tags are often used to group table contents.- The form of
<form>
Tag definition,action
Property defines the address at which the form is submitted,method
Property defines how the form is submitted.
Code:
<input type="text">
<input type="password">
<input type="radio">
<input type="checkbox">
<input type="submit">
<input type="reset">
<input type="button">
<input type="image">
<input type="file">
<input type="hidden">
Copy the code
The <select> <option> size attribute is used to set the height of the selection bar, and the multiple attribute is used to determine whether the list is selected or selected="selected".Copy the code
Form control for entering more text
The < textarea > element
The
name
For submitting parametersvalue
Used to enter text contentcols
androws
For the number of columns and lines, width and height of the text box respectively.
Effect:
Code:
<form action="web" method="post"> <br/> <textarea rows="10" cols="50" name="introduce"> </textarea> <br/> <input type="submit" id="" name=""> </form>Copy the code
frameset
<frameset>
Defines a frameset for organizing multiple Windows, with each frame holding a separate HTML document<frameset>
Can’t with<body>
Common use, unless available<noframe>
The element<frame>
Used to define<frameset>
A specific window in. Empty elements<frame/>
Frame properties
attribute | instructions |
---|---|
src |
Displayablehtml The document |
frameborder |
Defines the outer border of the frame with an attribute value of 0 or 1 |
scrolling |
Defines whether to display a scroll bar, with three values: yes,no,auto |
noresize="noresize" |
Definition The frame cannot be resized. it is resizable by default |
marginheight andmarginwidth attribute |
Define the top, bottom, left, and right margins |
<noframe>
For displaying text for browsers that do not support framesets<iframe>
, and<frame>
The elements are the same,iframe
There areframe
Property, and also addedheight
andwidth
Code:
<! DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>frameset</title> </head> <frameset cols="25%,50%,25%"> <frame src="https://blog.csdn.net/qq_36232611" scrolling="no" noresize="noresize"></frame> <frame src="https://juejin.cn/user/1451011081249175" ></frame> <frame src="https://www.jianshu.com/u/c785ece603d1" ></frame> </frameset> <noframes> <body> Your browser cannot handle frames, please change your browser to open </body> </noframes> </ HTML >Copy the code
The reserved character
Reserved characters in HTML must be replaced with character entities.
According to the results | describe | The entity name | The entity number |
---|---|---|---|
The blank space | |
The & # 160; |
|
< | Less than no. | < |
& # 60; |
> | More than no. | > |
The & # 62; |
& | And no. | & |
& # 38; |
“ | quotes | " |
& # 34; |
‘ | apostrophe | ' (IE not supported) |
& # 39; |
¢ | Point (cent) | ¢ |
The & # 162; |
£ | The pound (pound) | £ |
The & # 163; |
selections | Yuan (yen) | ¥ |
The & # 165; |
euro | The Euro | € |
The & # 8364; |
§ | section | § |
The & # 167; |
© | Copyright (Copyright) | © |
The & # 169; |
® | The registered trademark | ® |
The & # 174; |
™ | The trademark | ™ |
The & # 8482; |
x | Multiplication sign | × |
The & # 215; |
present | devide | ÷ |
The & # 247; |
CSS Basics
css
In English,Cascading Style Sheets
Cascading style sheets. Cascading style sheets.css
Is a presentation language, is a supplement to the web language.css
Style design for web pages, including font, color, location, etc.css
There are 4 ways to use: Import external style files, import external style files, use internal style definitions, and use inline style definitions.
Import external style files:
<link type="text/ CSS "rel="stylesheet" href=" CSS style file URL "/>Copy the code
Import an external style file:
<style type="text/ CSS "> @import "CSS style file url"; </style>Copy the code
Using internal style definitions:
<style type="text/css">
div {
background-color: #ffffff;
width: 300px;
height: 300px;
}
</style>
Copy the code
Use inline style definitions:
<div style="background-color: #ffffff; width: 100px; height: 100px;" > </div>Copy the code
CSS has two features: cascading and inheritance
Cascade: priority for cascading styles to work:
Inline Style -> Internal Style -> External Style -> Browser Default.
Inheritance means that CSS properties can be passed down from parent elements to child elements.
css
The selector
- Element selectors are the simplest selectors.
- Wildcard selector, with
"*"
Representation, representation is valid for any element. - Property selector
Format:
E[attribute]{property1:value1; property2:value2;...}
Copy the code
grammar | instructions |
---|---|
E[attribute] |
Use to select an element with the specified attribute |
E[attribute=value] |
Use to select an element with the specified attribute and the specified value |
E[attribute~=value] |
Use to select an element whose attribute value contains the specified value, which must be a full word, possibly preceded by a space |
E[attribute|=value] |
Use to select an element with an attribute value that begins with the specified value, which must be the entire word or be followed by a hyphen “-“ |
Derived selector
-
Derivation selectors define styles based on the context of the element at its location
-
There are three types of derived selectors: descendant selectors, child element selectors, and adjacent sibling selectors
-
Descendant selectors are all the elements that are descendants of an element.
-
A child selector is the first child of a condition relative to the parent.
-
The adjacent sibling selector is for sibling elements that have the same parent and are adjacent to each other.
-
Id selector that specifies the style as an HTML element with a specific ID value.
-
Class selector that specifies the style of the HTML element that specifies the class.
-
Pseudo class selector
Pseudo-class selectors: pseudo-class selectors and pseudo-element selectors
Pseudo-classes begin with a colon (:), cannot have Spaces between the element selector and the colon, and cannot have Spaces between pseudo-class names.
The following table lists common pseudo classes in the CSS:
Pseudo class name | instructions |
---|---|
:active |
Add styles to the activated elements |
:focus |
Add styles to elements that have input focus |
:hover |
Add styles to the elements over which you hover |
:link |
Add styles to links that are not accessed |
:visited |
Adds styles to links that have been accessed |
:first-child |
Adds a style to an element that is the first child of its parent |
:lang |
Direction band designationlang Attribute to the element add style |
Pseudo element selector
The following table lists common pseudo-elements in the CSS:
Pseudo element name | instructions |
---|---|
:first-letter |
Adds styles to the first letter of the text |
:first-line |
Add styles to the first line of text |
:after |
Add content after the element |
:before |
Add content before the element |
The CSS background
The CSS background attributes are as follows:
attribute | instructions |
---|---|
background-color |
Define the background color |
background-image |
Define background image |
background-repeat |
Defines whether and how the background image is repeated |
background-attachment |
Defines whether the background image scrolls with the content |
background-position |
Define the horizontal and vertical positions of the background image |
background |
You can define various background properties with a single style |
background
background-color
Used to set the background color, starting withtransparent
Transparent color.- The color can be a hexadecimal color, or an RGB function.
background-image
The background image used to set the element. The default isnone
.background-repeat
Controls the tiling of images.
The default background-repeat value is repeat, that is, the image is tiled along the X and y axes. You can also specify tiling rpeat-x along the X axis, repeat-y along the y axis, or no tiling no-repeat, inherit from the parent element.
background-attachment
Used to set whether the background image is fixed or scrolls along the rest of the page. The default value is:scroll
, indicating that you can scroll along with the rest of the page. Set up thefixed
“, the background image does not scroll while the rest of the page scrollsinherit
Inherits the parent element.background-position
Used to set the position of the background image dot.
Background can set background-color, background-position, background-attachment, background-repeat and background-image.
CSS Font Properties
CSS common font property table:
attribute | instructions |
---|---|
font-family |
Defines the font family for text |
font-size |
Defines the font size of the text |
font-variant |
Defines whether to display text in a small capital font |
font-style |
Defines whether the font of text is italic |
font-weight |
Define the size of the font |
font |
You can define various font properties in a single style |
font-family
Used to set the font of an element. This element attribute value can typically set multiple fonts.font-size
Used to set the font size.font-style
Used to set whether the font is italic. The default value isnormal
When set toitalic
Display as an italic style when set tooblique
, displayed as a slanted style.font-variant
Use to set the font to lowercase. Defaultnormal
Once set tosmall-caps
, changes all lowercase letters to uppercase.font-weight
Used to set the thickness of the font,normal
The value is equal to 400,bold
The value of theta is equal to 700.font
, you can setfont-family,font-size,font-style,font-variant,font-weight
.
CSS text property table:
attribute | instructions |
---|---|
color |
Text color |
direction |
Text direction or writing direction |
letter-spacing |
Character spacing |
line-height |
Line height of text |
text-align |
The horizontal alignment property of the text sets the horizontal alignment of the text of the elementLeft, Right, Center, Inherit . |
text-decoration |
Adds a modifier effect to the textUnderline underline, overline underline, line-through underline, blink underline,none inherit . |
text-indent |
Defines how to indent the first line of text. The default value is 0 |
text-shadow |
Adds a shadow effect to the text |
text-transform |
Toggles the case of text |
white-space |
How do you handle whitespace inside an element |
word-spacing |
Define the distance between words |
CSS size property table:
attribute | instructions |
---|---|
width |
Sets the width of the element |
min-width |
Sets the minimum width of the element |
max-width |
Sets the maximum width of the element |
height |
Sets the height of the element |
min-height |
Sets the minimum height of the element |
max-height |
Sets the maximum height of the element |
CSS list property table:
attribute | instructions |
---|---|
list-style-image |
Set the list item tag style to image,none/inherit/url |
list-style-position |
Set the position of the list item marker,inside/outside/inherit |
list-style-type |
Sets the type of list item tags |
list-style |
You can define various list properties with a single style |
list-style-type
value | instructions |
---|---|
disc |
Solid round |
circle |
The hollow circle |
square |
square |
decimal |
digital |
low-roman |
Lower Roman numerals |
upper-roman |
Capital Roman numeral |
low-alpha |
Lowercase letters |
upper-alpha |
The capital letters |
none |
No mark |
inherit |
Inherits this setting from the parent element |
CSS table property table:
attribute | instructions |
---|---|
border-collapse |
Sets whether to merge table borders |
border-spacing |
Sets the distance between adjacent cell borders |
caption-side |
Sets the position of the table title |
empty-cells |
Sets whether to display borders and backgrounds on hollow cells in the table |
table-layout |
Sets how to set the column width of a table cell |
The box model
css
A box model that contains element contentcontent
The paddingpadding
, borderborder
And externalmargin
.
CSS margin property, the inside margin of an element is between the border and the content.
CSS inner margin properties:
attribute | instructions |
---|---|
padding-top |
The upper inner margin of the element |
padding-right |
The right inner margin of the element |
padding-bottom |
The lower inner margin of the element |
padding-left |
The left inner margin of the element |
padding |
Define all margin attributes with a single declaration |
The setting sequence is top, right, bottom, left.
padding: 10px 10px 10px 10px;
Copy the code
CSS margin properties:
attribute | instructions |
---|---|
margin-top |
Defines the upper margin of an element |
margin-right |
Defines the right margin of the element |
margin-bottom |
Defines the lower margin of the element |
margin-left |
Defines the left margin of the element |
margin |
Define all margin attributes with a single declaration |
CSS border properties:
attribute | instructions |
---|---|
border-top-style |
The style property of the top border |
border-right-style |
Style property for the right border |
border-bottom-style |
The style property of the bottom border |
border-left-style |
Style property for the left border |
border-style |
Sets the style properties for the four borders |
border-top-width |
Sets the width property of the top border |
border-right-width |
Sets the width property for the right border |
border-bottom-width |
Sets the width property of the bottom border |
border-left-width |
Sets the width property of the bottom border |
border-width |
Sets the width property for the four borders |
border-top-color |
Sets the color property for the top border |
border-right-color |
Sets the color property for the right border |
border-bottom-color |
Sets the color property of the bottom border |
border-left-color |
Sets the color property for the left border |
border-color |
Sets the color properties of the four borders |
border-top |
Define all top border attributes with a single declaration |
border-right |
Define all right border properties with a single declaration |
border-bottom |
Define all attributes of the bottom borders with a single declaration |
border-left |
Define all attributes of the left border with a single declaration |
border |
Define attributes for all borders with a single declaration |
border-width |
Define the width of 4 borders at a time |
border-color |
Define 4 border colors at a time |
Border style
none
, no border effecthidden
, andnone
The samedotted
, dot line border effectdashed
, dashed border effectdouble
Double line border effectsolid
Solid border effectgroove
, 3D groove border effectridge
, 3D convex groove border effect
A CSS outline is a line drawn around an element, around the edge of the border, to highlight the element.
attribute | instructions |
---|---|
outline-style |
Defines the style properties of the contour |
outline-color |
Defines the color properties of the contour |
outline-width |
Defines the width property of the contour |
outline |
Define all contour attributes in the same declaration |
The layout properties
- Layout attributes are rules for arranging and displaying elements in a document
- There are three layout modes: normal document flow, float, and Position
Properties involved in CSS floating
attribute | instructions |
---|---|
float |
Set whether the box needs to float and in which direction |
clear |
Sets the side of the element on which other floating elements are not allowed |
clip |
Clipping absolute positioning element, the element must be absolute positioning, top right, bottom left principle |
overflow |
Set the handling of content overflow element boxes, value:visible,auto,hidden,scroll |
display |
How does the element display its valuenone,block,inline,inline-block,inherit |
visibility |
Defines whether the element is visible,visibility If set to hidden, the space occupied by the element remains, butdisplay:none No reserved occupied space, value:visible,hidden |
Attributes of the CSS location
attribute | instructions |
---|---|
position |
Element location type, valuestatic .absolute Absolutely,relative The relative |
top |
Margin on the element |
right |
Element right margin |
bottom |
Element lower margin |
left |
The left margin of the element |
z-index |
The stack order of elements |
Z-index sets the location hierarchy of the target object. A larger value indicates a higher level. This property is valid only if position: Absolute.
❤️ thank you
1. If this article is helpful to you, please support it with a like. Your like is the motivation for my writing.
2. Add wechat [Xiaoda0423] and pull you into the technical exchange group to study together.