Scenario 1: To achieve a semi-transparent border: Due to the default behavior of CSS styles, the background color is rendered in the range of content+padding+border. The semi-transparent border is affected by the main color, and the effect achieved is Solution: Use the background-clip property to specify the background drawing area so that the drawing area is limited to content + padding. Div { border:10px solid rgba(0,0,0,.5); background: lightblue; background-clip: padding-box; } Supplement: background-clip is not compatible with IE6-8, Opera10 Scenario 2: To implement multiple borders: Solution 1: Use box-shadow to generate multiple projections The code and effect are as follows: div { background:#c3e6f4; box-shadow:0 0 0 15px #b7dae6,0 0 0 30px #cce2ea; } Solution 2: Box border combined with stroke attributes (outline) Features: Only double borders can be achieved, more flexible, and can use dotted line and other effects The code and effect are as follows: div { border: 6px dashed #c3f4ec; outline: 10px solid #d9faf6; background-clip: padding-box; } Summarize The above is the scenario analysis of implementing semi-transparent borders and multiple borders with CSS introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: TypeScript problem with iterating over object properties
>>: Summary of MySQL slow log related knowledge
<br />This article has briefly explained the...
To achieve the association of the frame window, th...
Table of contents js deep copy Data storage metho...
1. Technical points involved vite version vue3 ts...
1. The Importance of Indexes Indexes are used to ...
The webpage displays 403 Forbidden Nginx (yum ins...
Typically, we use the following SQL statement to ...
Knowing the IP address of a device is important w...
Table of contents Preface Single file components ...
When installing packages on an Ubuntu server, you...
1. Error error connecting to master 'x@xxxx:x...
This article mainly introduces three methods of i...
What are Routing and Routing Table in Linux? The ...
Project Purpose Migrate the data in MySQL 5.5.53 ...
Additional explanation, foreign keys: Do not use ...