Calculation of the box model <br />Margin + border + padding + content The width and height in CSS only set the height and width of the content area. Not the height and width of the entire model. Copy code The code is as follows:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>demo</title> <style type="text/css"> *{margin:0; padding:0;} dl { background:red;border:10px solid #000; width:100px; height:100px;} dt { background:yellow;} dd { background:green;} </style> </head> <body> <dl> <dt>test of dt</dt> <dd>test of dd</dd> </dl> </body> </html> Setting margins and padding will not affect the height and width of the content area, but only change the height and width of the secondary box model area. When the box models are nested, the inner box model will affect the outer box model. |
<<: The actual process of implementing the guessing number game in WeChat applet
>>: The difference between animation and transition
Preface lvm (Logical Volume Manager) logical volu...
Many times, after we install a web service applic...
Borrowing Constructors The basic idea of this t...
Detailed installation tutorial of mysql-5.7.23-wi...
XML/HTML CodeCopy content to clipboard < input...
1. Download the required packages wget -P /usr/lo...
Step 1: yum install httpd -y #Install httpd servi...
tomcat server configuration When everyone is lear...
Table of contents 1. Rule 1: Object.Method() 1.1 ...
Sometimes local development requires debugging of...
Introduction to Swap Swap (i.e. swap partition) i...
When we preview PDF on the page, some files canno...
1. MySQL gets the current date and time function ...
Table of contents 1. Introduction 2. Prepare a pr...
Table of contents 1. Cross-domain filter CorsFilt...