当前位置:网站首页>Block, there is a gap between the block elements in the row
Block, there is a gap between the block elements in the row
2022-07-27 08:23:00 【Gru 977】
img Yes Block in row characteristic , There is a gap between the block elements in the row ‘
Take this code as an example
<div class="box">
<img src="./tutu.jpg" alt="">
<img src="./tutu.jpg" alt="">
</div>
reason :
Inline block element :
There is Line break , Space , enter When waiting for operation , There will be spaces by default in browser parsing .
resolvent :
Law 1 :
Put two photo labels on one line
<div class="box">
<img src="./tutu.jpg" alt=""><img src="./tutu.jpg" alt="">
</div>But this is not followed Web Standards to develop (HTML Write web page structure and content ,CSS Control layout , Text / Display style of pictures, etc )
The separation of structure and expression :HTML Tags only build the basic structure of web pages .CSS Set all the styles of the web page .
Don't be unable to adjust the style , And modify the web page structure . Because the web page needs to be maintained later , The structure of the web page should be simple and easy to understand .
Law two :
Parent element Settings :font-size:0px;
.box {
width: 800px;
height: 400px;
background-color: rgb(117, 51, 216);
font-size: 0;
}however , If the parent element has text , Will make the text size change ( The text size becomes 0)
Law three :
margin Set to negative
My picture here , Set up -5px that will do , Fine tune according to your picture
img:last-child {
margin-left: -5px;
}however , You need to fine tune the distance between each element , If the space is occupied ( size ) Change , You need to modify the distance between each element again .
Law four :
The parent element is set to elastic layout ,
Subelement You have to set the width and height , No width or height , Pictures will be covered with parents ( There may be other ways to deal with )

At the same time, the width and height are larger than the child

.box {
width: 500px;
height: 300px;
background-color: rgb(117, 51, 216);
display: flex;
}
img {
width: 200px;
height: 200px;
}This can be achieved .
Law five :
add to float attribute ( float )
Add to the element that needs to float , Add it to the picture here .
img {
float: left;
}边栏推荐
- [ciscn2019 southeast China division]web11 1
- Dasctf2022.07 enabling game password WP
- 关于数据库的接口响应非常慢
- It's better to be full than delicious; It's better to be drunk than drunk
- ERP production operation control Huaxia
- "Intermediate and advanced test questions": what is the implementation principle of mvcc?
- [target detection] yolov6 theoretical interpretation + practical test visdrone data set
- 说透缓存一致性与内存屏障
- Attack and defense World Lottery
- File name wildcard rules for kettle
猜你喜欢

Download and usage of sequel Pro
![[target detection] yolov6 theoretical interpretation + practical test visdrone data set](/img/ad/78835eea4decc15e0981e6561b875f.png)
[target detection] yolov6 theoretical interpretation + practical test visdrone data set

File name wildcard rules for kettle

Apache SSI remote command execution vulnerability
![[applet] the upload of the wechat applet issued by uniapp failed error: error: {'errcode': -10008,'errmsg':'Invalid IP](/img/0c/da2ffc00834793c7abc0f7ebe6321b.png)
[applet] the upload of the wechat applet issued by uniapp failed error: error: {'errcode': -10008,'errmsg':'Invalid IP

Teach you to build a nail warning robot hand in hand

What are the software tuning methods? Let's see what Feiteng technology experts say about dragon lizard technology

All in one 1353 -- expression bracket matching (stack)

虚拟机克隆

regular expression
随机推荐
海量数据肖枫:共建共治openGauss根社区,共享欣欣向荣新生态
You may need an additional loader to handle the result of these loaders.
Local Oracle reported ora-12514: tns: the listener cannot recognize the requested service at present
JS rotation chart
arguments
Five day travels to Beijing
Use of "PHP Basics" delimiters
Data extraction 2
MCDF顶层验证方案
数据提取2
All in one 1353 -- expression bracket matching (stack)
Introduction to depth first search (DFS)
Why do major domestic manufacturers regard cloud computing as a pastry? Do you really understand this trillion market
Set set
借生态力量,openGauss突破性能瓶颈
[BJDCTF2020]EasySearch 1
Idea remote debugging
pytorch_ demo1
Data extraction 1
QPushButton 按钮的创建与简单应用