CSS Skills Collection - Classics among Classics

CSS Skills Collection - Classics among Classics
Remove the dotted box on the link

Copy code
The code is as follows:

a:active, a:focus {
outline:none;
}

By default, Firefox will add a dotted border when a link is focused (or clicked), which can be removed using the above properties.

The simplest CSS reset

Copy code
The code is as follows:

* {
margin: 0; padding: 0
}

Do not wrap links

Copy code
The code is as follows:

a {
white-space:nowrap;
}

The above setting can avoid link wrapping, but I personally recommend that long links have a corresponding line (for discussion on line wrapping, see the record of the center of the circle).

Always show scroll bars in Firefox

Copy code
The code is as follows:

html {
overflow:-moz-scrollbars-vertical;
}

More Mozilla/Firefox private CSS properties can be found here. Need cross-browser support, you can also use

Copy code
The code is as follows:

body, html {
min-height:101%;
}

Use line-height to center vertically

line-height:24px;

When using a fixed-width container and need to vertically center a line, use line-height (the height is the same as the parent container). For more vertical centering summary, see here.

Clear container float

Copy code
The code is as follows:

#main {
overflow:hidden;
}

Centers a block element horizontally
margin:0 auto;
In fact,

Copy code
The code is as follows:

margin-left: auto;
margin-right: auto;

This technique is explained in almost all CSS textbooks. Don't forget to add a width to it. You can also use it in Exploer

Copy code
The code is as follows:

body{
text-align: center;
}

Then define the inner container

text-align: left;

recover.

Hide the scroll bar of Exploer textarea

Copy code
The code is as follows:

textarea {
overflow:auto;
}

Exploer By default, textarea will have a vertical scrollbar (don't ask me why).

Set print pagination

Copy code
The code is as follows:

h2 {
page-break-before:always;
}

The page-break-before attribute can set the paging when printing a web page.

<<:  JavaScript function call classic example code

>>:  Detailed explanation of CSS label mode display property

Recommend

N ways to achieve two-column layout with CSS

1. What is a two-column layout? There are two typ...

MySQL primary key naming strategy related

Recently, when I was sorting out the details of d...

Solve the problem of docker container exiting immediately after starting

Recently I was looking at how Docker allows conta...

vue.config.js packaging optimization configuration

The information on Baidu is so diverse that it...

Simple usage example of vue recursive component

Preface I believe many students are already famil...

Detailed explanation of how to adjust Linux command history

The bash history command in Linux system helps to...

VMware Workstation 14 Pro installs CentOS 7.0

The specific method of installing CentOS 7.0 on V...

SQL Get stored procedure return data process analysis

This article mainly introduces the analysis of th...

MySQL master-slave data is inconsistent, prompt: Slave_SQL_Running: No solution

This article uses an example to describe the solu...

Detailed explanation of the benefits of PNG in various network image formats

BMP is an image file format that is independent o...

Detailed steps for deploying Tomcat server based on IDEA

Table of contents Introduction Step 1 Step 2: Cre...

HTML fixed title column, title header table specific implementation code

Copy code The code is as follows: <!DOCTYPE ht...

CSS to achieve chat bubble effect

1. Rendering JD Effect Simulation Effect 2. Princ...

Linux hardware configuration command example

Hardware View Commands system # uname -a # View k...