当前位置:网站首页>Positioning and decoration style
Positioning and decoration style
2022-04-23 08:05:00 【GuTaiWEI】
location
Positioning mode
Property value | Reference system | characteristic | remarks |
---|---|---|---|
static | position The default value of | nothing | Invalid set offset value |
relative ( Relative positioning ) | Oneself | Do not delist | It is usually used in the structure of son Jue father phase , The offset value is not needed at this time |
absolute ( Absolute positioning ) | Locate the nearest outer element or document ( Browser window ) | Complete de labeling | Usually used with offset values |
fixed ( Fixed position ) | Browser viewable window | Complete de labeling | Usually used with offset values , Don't follow the scroll bar , Width and height should be set |
sticky ( Viscous positioning ) | Itself and browser window | Partial off standard | A scroll bar appears on the page , At least one offset value needs to be set |
Be careful :
- Element is not set left、top、right、bottom When is invalid
- left and top The priority ratio right and bottom Be taller
- Positioning elements will become similar Inline block element Characteristics , Width and height can be set , Don't monopolize a line
- position Valid for all elements
- The level of positioning elements is the same , There is lamination , The rear positioning element will cover the front positioning element , Use Fixed position Need to pay attention to
Offset value
type | Value | remarks |
---|---|---|
left | px Or percentage | Usually and right Just one , When used at the same time left first |
top | px Or percentage | Usually and bottom Only one of them , When used at the same time top first |
right | px Or percentage | |
bottom | px Or percentage |
z-indx Display hierarchy
Format : z-index:
Integers ;
Be careful :
- The larger the value , The higher the display order , z-index The default value of is 0, You can set negative
- z-index Only with positioning can it take effect , By default , Positioned box Later generations live in
Application of positioning ( Vertical center )
/* The absolute positioning element is horizontally and vertically centered */
.box{
position: absolute;
/* Ideas 1:left:50% top:50% then margin-left:- Half the width of itself ; margin-top:- Half its height ; */
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -100px;
/* Ideas 2: left:0;top:0;right:0;bottom:0;margin:auto; */
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 100px;
height: 100px;
background-color: pink;
/* Ideas 3 left:50% top:50% transform:translate(-50%,-50%) */
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
Decorative style
vertical-align Set vertical alignment
Application scenarios : Applied to solve vertical problems Alignment issues for
Effective range : Valid only for inline elements or inline block elements
Property value :
- middle( Vertical center )
- top ( Align vertically up )
- bottom( Align vertically down )
- xxxpx( be based on baseline)
- Default Baseline alignment
Typical scenario : solve img No height is set outside div Bottom and img There is a gap at the bottom ( The reasons causing : Baseline alignment )
<style>
Solution 1:
img {
display:block;
}
Solution 2:
img {
vertical-align:middle;
}
Solution 3:
div {
font-size:0;
}
</style>
<div class="father"><img src="./images/1.jpg" alt=""></div>
cursor Set the mouse cursor
Common values :
default
arrowpointer
Little handstext
editmove
Crossnot-allowed
prohibit
border-radius Set rounded border
Setting mode :
/* Set four fillet radii Are all 10px*/
border-radius:10px;
/* Set four fillet radii All are wide 50%/ high 50% When the box is square, it can realize circle When it is rectangular, realize ellipse */
border-radius:50%;
/* Set separately Top left The upper right The lower right The lower left ( Clockwise ) Four fillet radii by 10px 20px 30px 40px*/
border-radius: 10px 20px 30px 40px;
/* Set the fillet radius of the upper left corner separately by 10px*/
border-top-left-radius:20px;
Hidden elements
Show hidden :
-
overflow:hidden
: Overflow hiddenoverflow:auto
: Scroll bar appears when overflowoverflow:scroll
: There's always a scroll baroverflow:visible
: Overflow display ( Default state )
-
opacity
:1 Completely opaque 0 Completely transparent 0.5 translucent
Implicitly hide :
-
display:none
: Pure Hidden , Does not occupy a space -
visibility:hidden
: Take up space
border-collapse Set up Border merge
table {border-collapse:collapse;/* Set border merging to realize thin line border */}
border Realize the small triangle
<style>
.box {
width: 0;
height: 0;
margin:50px auto;
border:20px solid;
/* Realize the isosceles right triangle with the arrow to the right */
border-color: transparent transparent transparent pink;
}
.box1 {
width: 0;
height: 0;
margin:50px auto;
border-style:solid;
border-width:0 150px 50px 150px;
/* Realize that the two right angle sides of the arrow to the right are 50 150 Right triangle of */
border-color:transparent transparent transparent red;
}
</style>
<div class="box"></div>
<div class="box1"></div>
版权声明
本文为[GuTaiWEI]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230624538807.html
边栏推荐
- Internal network security attack and defense: a practical guide to penetration testing (8): Authority maintenance analysis and defense
- Internal network security attack and defense: a practical guide to penetration testing (VII): cross domain attack analysis and defense
- C smoothprogressbar custom progress bar control
- Link to some good tutorials or notes about network security and record them
- 《内网安全攻防:渗透测试实战指南》读书笔记(八):权限维持分析及防御
- upload-labs 靶场练习
- RGB color to hex and unit conversion
- 一文了解系列,对web渗透的常见漏洞总结(持续更新)
- Reading notes
- CTF-MISC总结
猜你喜欢
SAP tr manual import system operation manual
CTF攻防世界刷题51-
Intranet penetration series: dnscat2 of Intranet tunnel
The displayed amount of ABAP ALV is inconsistent with the exported amount
Ctf-misc summary
云计算技能大赛 -- openstack私有云环境 第二部分
[unity VFX] Introduction notes of VFX special effects - spark production
Zhuang understand's TA notes (VI) < fakeenvreflect & rust, rust effect >
Intranet penetration series: pingtunnel of Intranet tunnel
[NLP notes] preliminary study on CRF principle
随机推荐
【编程实践/嵌入式比赛】嵌入式比赛学习记录(一):TCP服务器和web界面的建立
KVM安装部署
CTF攻防世界刷题51-
vivo,硬件安全的爱与雷霆
Intranet penetration series: icmptunnel of Intranet tunnel (by master dhavalkapil)
云计算技能大赛 -- openstack私有云环境 第二部分
第五章 投资性房地产
数据库之MySQL——基本常用查询命令
RGB color to hex and unit conversion
从ES、MongoDB、Redis、RocketMQ出发谈分布式存储
CTF-MISC学习之从开始到放弃
MySQL--锁的奥秘--数据怎么锁
[NLP notes] preliminary study on CRF principle
Interview learning route
C read INI file and write data to INI file
求3个字符串(每串不超过20个字符)中的最大者。
C smoothprogressbar custom progress bar control
feign如何集成hystrix
Research on software security based on NLP (I)
Research on system and software security (5)