Use classes as little as possible because they can be cascaded and recognized, such as: .News h3 without adding classes to h3
3. Use div
Can be changed to
4. Selector
p a h1 type selector
Li a {text-decoration:none} Descendant selector
*{ padding:0;} Universal selector, all elements on the page.
5. Positioning
Relative positioning is relative to the position where it should appear
Absolute positioning is relative to the nearest positioned ancestor element (experiments found that ancestor elements need to be set to relative positioning)
Floating The box can move left and right until its edge touches the containing box or the edge of another containing box. Because the floated box is not in the normal flow of the document, a box in the normal flow of the document behaves as if the floated box does not exist.
Summary: If a div is floated, the next div will be treated as if the first one does not exist. Know when floating or containing boxes are encountered.
Clear: right The right side of the floating box is available
Clear: left The left side of the floating box is available
Clear: both Both sides of the floating box are not available
Applying the overflow attribute with a value of hidden or auto will automatically clean up Any floating elements contained.
6. Gradient background
Create a very tall but narrow gradient image, tiled horizontally
Body
{
Background: #ccc url (gradient.gif) repeat-x; }
But it is difficult to predict how high the image page will be, so you can combine it with the background color. When the image ends, the color will come out. If the color difference between the two is very close, the conversion will not be visible.
Example: Add an icon to each title
H1
{
Padding-left:30px;
Background: url(/images/bullet.gif) no-repeat left center;
}
7. Highlight different types of links
For example: links to external sites, emails, downloads, etc.
.external
{
Background: url (/images/externalLink. gif) no-repeat right top;
Padding-right:10px;
}
8. Table-specific elements
1) Summary and Caption
Summary attributes can be applied to table labels, Describe the content of the table
Caption The title of the table
2) thead tbody tfoot
I.e You can put all column headers in thead element. If you choose to use thead or tfoot element, you must use at least one tbody element. A table can only use one thead and tfoot, but can use multiple tbodies.
9. Border model of the table
1) Individual model: Each cell has a border around it
2) Overlay model: Cell Grid shared border
10. Form layout
Fieldset turns off the border. Lower versions do not support it, but you can use
Filedset
{
Border: solid 0 transparent;
}
11 . Form label label
Implicit mode:
Display mode:
The use of paragraphs in forms is controversial.
12. Let the design play a part
Method 1:
#wrapper
{
Width:720px;
Margin:0 auto;
}
But this method is not normal in IE6 and below
Method Two (need to be combined based on two elements): Use automatic blank
Body
{
Text-align:center;
Min-width: 760;
}
#wrapper {
Width:720px;
Margin: 0 auto;
Text-align: left;
}
Method 3: Use positioning and negative white space to change
#wrapper {
Width:720px;
Position: relative;
Left: 50%;
Margin-left: -360;
}
13: Fluid layout: use all sizes Percent rather than pixel setting
Advantages: Width changes with browser size.
Disadvantages: As it gets smaller, the rows get narrower.
Solution: Set min-width in pixels and ems
14: Flexible layout: When the font size changes, the rows change (unit is em)
Flexible layout sets the width of the element relative to the font size.
1em=10px;
The default font size of most browsers is 16px, 10 is equivalent to 62.5% of 16 pixels.
Body
{
Font-size:62.5%;
} #wrapper
{
Width:72em;
Margin:0 auto;
Text-align: left;
}
#mainNav
{
Width: 18em;
Float:right;
}
15. Elastic fluid layout: set the width in em and set the maximum width in percentage.
#wrapper
{
Width:72em;
Max-width: 100%;
Margin:0 auto;
Text-align: left;
}
16: Fluid and elastic images
Image deformation problem: Try to put it in the background
17. Asterisk HTML trick
* html a:hover
{
Body-style: solid
}
Only useful in IE6 or below
18: !import and underline tricks
#nav
{
Position: fixed !important;
Position : static;
}
or
#nav
{
Position: fixed;
_Position : static;
}
19, when there are several columns
Nav needs to distinguish colors and display height 100%. You can make a picture with a width equal to Nav. Set a background image on the main and tile it in the vertical direction.

I got this question the other day. My first thought is: weird question! Specificity is about selectors, and at-rules are not selectors, so... irrelevant?

Yes, you can, and it doesn't really matter in what order. A CSS preprocessor is not required. It works in regular CSS.

You should for sure be setting far-out cache headers on your assets like CSS and JavaScript (and images and fonts and whatever else). That tells the browser

Many developers write about how to maintain a CSS codebase, yet not a lot of them write about how they measure the quality of that codebase. Sure, we have

Have you ever had a form that needed to accept a short, arbitrary bit of text? Like a name or whatever. That's exactly what is for. There are lots of

I'm so excited to be heading to Zürich, Switzerland for Front Conference (Love that name and URL!). I've never been to Switzerland before, so I'm excited

One of my favorite developments in software development has been the advent of serverless. As a developer who has a tendency to get bogged down in the details

In this post, we’ll be using an ecommerce store demo I built and deployed to Netlify to show how we can make dynamic routes for incoming data. It’s a fairly


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment