当前位置:网站首页>43 box model
43 box model
2022-07-25 14:46:00 【hello_ sunny123】






One . Frame

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>08- The frame of the box model .html</title>
<style> div {
width: 300px; height: 200px; /* border-width: The thickness of the border Usually use px; */ border-width: 5px; /* border-style: The style of the border solid Solid line frame dashed Dotted border dotted Dotted border */ /* border-style: The style of the border solid Solid line frame */ border-style: solid; /* border-style: The style of the border dashed Dotted border */ /* border-style: dashed; */ /* border-style: The style of the border dotted Dotted border */ /* border-style: dotted; */ /* border-color: Color of border */ border-color: pink; } </style>
</head>
<body>
<div></div>
</body>
</html>
result

Two . Composite writing

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>08- Composite writing .html</title>
<style> div {
width: 300px; height: 200px; /* border-width: 5px; */ /* border-style: The style of the border solid Solid line frame dashed Dotted border dotted Dotted border */ /* border-style: solid; */ /* border-color: pink; */ /* The compound writing of border Abbreviation */ /* border: 5px solid pink; */ /* On the border */ border-top: 5px solid pink; /* Under the frame */ border-bottom: 10px dashed purple; /* The left margin */ border-left: 5px solid #000; /* Right margin */ border-right: 5px solid red; } </style>
</head>
<body>
<div></div>
</body>
</html>
result


Exercise code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Border exercise </title>
<style> div {
/* Give me a 200*200 Box , Set the top border to red , Other borders are blue */ width: 200px; height: 200px; /* border Contains four sides */ border: 10px solid blue; /* Layering Only the top border is stacked */ border-top: 10px solid red; } </style>
</head>
<body>
<div></div>
</body>
</html>
result

3、 ... and . Table thin line border

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Novel ranking </title>
<style> table {
width: 500px; height: 249px; } th {
height: 35px; } table, td, th {
border: 1px solid pink; /*border-collapse Merge adjacent borders */ border-collapse: collapse; font-size: 14px; text-align: center; } </style>
</head>
<body>
<table align="center" cellspacing="0">
<thead>
<tr>
<th> ranking </th>
<th> key word </th>
<th> trend </th>
<th> Search today </th>
<th> The last seven days </th>
<th> Related links </th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td> Ghost blows </td>
<td><img src="images/down.jpg" /></td>
<td>345</td>
<td>123</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>2</td>
<td> The Lost Tomb </td>
<td><img src="images/up.jpg" /></td>
<td>124</td>
<td>675432</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>3</td>
<td> Journey to the west </td>
<td><img src="images/down.jpg" /></td>
<td>212</td>
<td>7654</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>4</td>
<td> Journey to the East </td>
<td><img src="images/down.jpg" /></td>
<td>23</td>
<td>75645</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>5</td>
<td> Zhen Huan preach </td>
<td><img src="images/up.jpg" /></td>
<td>121</td>
<td>7676</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>6</td>
<td> Water margin </td>
<td><img src="images/down.jpg" /></td>
<td>576576</td>
<td>1231421</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
<tr>
<td>7</td>
<td> The romance of The Three Kingdoms </td>
<td><img src="images/down.jpg" />></td>
<td>234</td>
<td>7686</td>
<td> <a href="#"> tieba </a> <a href="#"> picture </a> <a href="#"> Encyclopedias </a></td>
</tr>
</tbody>
</table>
</body>
</html>
result

Four .(1) The border will affect the actual size of the box

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>12- The border will affect the actual size of the box </title>
<style> div {
width: 180px; height: 180px; background-color: pink; border: 10px solid red; } </style>
</head>
<body>
<div></div>
</body>
</html>
result

Four .(2) padding

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>13- The inside margin of the box model </title>
<style> div {
width: 200px; height: 200px; background-color: pink; padding-left: 20px; padding-top: 30px; padding-right: 20px; } </style>
</head>
<body>
<div>
The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content
</div>
</body>
</html>
result

Four . padding padding attribute : above 4 Kind of , In development, you will encounter

Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>14- Compound writing method of inner margin of box model </title>
<style> div {
width: 200px; height: 200px; background-color: pink; /* padding-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; */ /* Inside margin compound writing */ /* Followed by a number : It means up, down, left and right 5px*/ /* padding: 5px; */ /* Followed by two numbers : Up and down are 5px Right and left are 10px*/ /* padding: 5px 10px; */ /* Followed by three numbers : On behalf of 5px Right and left are 10px Next is 20px*/ /* padding: 5px 10px 20px; */ /* Followed by three numbers : On behalf of 5px On the right is 10px* Next is 20px Left is 30px Clockwise */ padding: 5px 10px 20px 30px; } </style>
</head>
<body>
<div>
The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content The contents of the box are content
</div>
</body>
</html>
result

5、 ... and . The inner margin affects the actual size of the box

Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>15- The inner margin affects the actual size of the box </title>
<style> div {
/* width: 200px; height: 200px; */ /* In order to avoid supporting a big box 200-20*2=160 */ width: 160px; height: 160px; background-color: pink; padding: 20px; } </style>
</head>
<body>
<div>padding Will affect the actual size of the box padding Will affect the actual size of the box padding Will affect the actual size of the box padding Will affect the actual size of the box padding Will affect the actual size of the box </div>
</body>
</html>
result

边栏推荐
猜你喜欢

Live classroom system 05 background management system

Gameframework making games (I)

GameFramework制作游戏(一)

Sudo rosdep init error ROS installation problem solution

【口才】谈判说服技巧及策略

37 element mode (inline element, block element, inline block element)

基于AMD EPYC服务器的EDA芯片设计解决方案

LeetCode-198-打家劫舍

L1和L2正则化

How to make a set of code fit all kinds of screens perfectly?
随机推荐
(original) customize a scrolling recyclerview
关于RDBMS和非RDBMS【数据库系统】
IP address classification, which determines whether a network segment is a subnet supernetwork
PS making and loading GIF pictures tutorial
各种平台dpkg包下载地址(包括arm64)
Deng Qinglin, a technical expert of Alibaba cloud: Best Practices for disaster recovery and remote multi activity across availability zones on cloud
As methods for viewing and excluding dependencies
基于AMD EPYC服务器的EDA芯片设计解决方案
【口才】谈判说服技巧及策略
MySQL的登陆【数据库系统】
MySQL 45 talks about | 06 global locks and table locks: Why are there so many obstacles to adding a field to a table?
GameFramework制作游戏(二)制作UI界面
变分(Calculus of variations)的概念及运算规则
37 元素模式(行内元素,块元素,行内块元素)
Software testing -- 1. Outline of software testing knowledge
Leetcode-198- house raiding
I hope some suggestions on SQL optimization can help you who are tortured by SQL like me
没错,请求DNS服务器还可以使用UDP协议
Realsense-Ros安装配置介绍与问题解决
I2C device driver hierarchy