What are the common HTML codes that programmers must know

You are currently viewing What are the common HTML codes that programmers must know

html+css code

Text settings

1. Font-size: font size

2.font-style: font format

3. Font-weight: font weight

4. Color attribute color: text color

Pay attention to the use of web-safe colors

Hyperlink settings

text-decoration: parameters

Parameter value range:

underline: underline the text

overline: add a line to the text

line-through: Strikethrough text

blink: make the text blink

none: Do not display any of the above effects


1. Background color

background-color: set the background color

2. Background picture

background-image: url(URL)

URL is the storage path of the background image, and none means none.

3. Duplicate background image

background-repeat: parameters

Parameter value range:

no-repeat: Do not repeat the tiled background image

repeat-x: Make the picture tile only in the horizontal direction

repeat-y: make the picture tile only in the vertical direction

If you do not specify the background image repeat attribute, the browser defaults to tile the background image in both horizontal and vertical directions.

4. The background picture is fixed

background-attachment: parameters

The background picture is fixed to control whether the background picture scrolls with the scrolling of the webpage. If you do not set the background image fixed attribute, the browser defaults the background image to scroll with the scrolling of the web page. In order to avoid overly fancy background images distracting the viewer’s attention when scrolling, they are generally set to be fixed.

Parameter value range:

fixed: When the webpage is scrolled, the background image is fixed relative to the browser window

scroll: When the webpage is scrolled, the background image is scrolled together with respect to the browser window


1. Word spacing

word-spacing: word spacing

2. Letter spacing

letter-spacing: letter spacing

3. Text alignment

text-align: parameter

The value of the parameter:

left: left aligned

right: Right aligned

center: center alignment

justify: align the left and right ends relative to each other

4. Vertical alignment

vertical-align: parameter

top: top alignment

bottom: bottom alignment

text-top: relative text top alignment

text-bottom: align relative to the bottom of the text

baseline: baseline alignment

middle: center aligned

sub: display in the form of a subscript

super: display in the form of superscript

5. Text indentation

text-indent: indent distance

12px is equivalent to a text distance

6. Space

white-space: parameter

Parameter value range:

normal default, blank will be ignored by the browser

pre leave blank

nowrap text does not wrap

7. Display style

display: parameters

Parameter value range:

block: block-level element, wrap before and after the object

inline: do not wrap before and after the object

list-item: wrap before and after the object, adding bullets

none: no display


1, height

2, width width

3. Padding inner margin

4. Margin

5. Float: You can arrange block-level elements in a row, such as a horizontal menu.

6, clear to clear the float


1. Style

border style parameter

Parameters of border style:

none: no border

dotted: the border is a dotted line

dashed: the border is a long and short line

solid: the border is a solid line

double: the border is a double line

2. Width border width

3. Color border color


list-style-type list style

The list symbols of different browsers may be different, which may affect the webpage, so most of the lists on the webpage are displayed by background pictures.

Control the style of the user interface


cursor: mouse shape parameter

CSS mouse shape parameter table:

Mouse shape: CSS code


style=”cursor:crosshair”    cross

style=”cursor:text”       text form

style=”cursor:wait”      Hourglass shape

style=”cursor:move”      cross arrow shape:

style=”cursor:help”       question mark shape

style=”cursor:e-resize”     right arrow shape

style=”cursor:n-resize”     up arrow shape

style=”cursor:nw-resize”    upper left arrow shape

style=”cursor:w-resize”    Left arrow shape

style=”cursor:s-resize”     down arrow shape

style=”cursor:se-resize”    right down arrow shape

style=”cursor:sw-resize”    left and down arrow shape

Also read – Python programming, python代写