当前位置:网站首页>How to use div boxes to simulate line triangles
How to use div boxes to simulate line triangles
2022-06-30 04:17:00 【Chang Li Lin】
One 、 Analysis method : Use boxes to simulate line triangles
Three boxes . One to limit the line position , The other two are divided into upper and lower structures , By means of rotation , Fine tuning top,left value , You can make line triangles .
Two 、 Add three boxes
External box em, Inner box i,b.em The box class The value of the property is arrow.
Source code :
<ul>
<li>
<a href=""> Destination </a>
</li>
<li>
<a href=""> kits </a>
</li>
<li class="have-menu">
<a href=""> Community </a>
<em class="arrow">
<b></b>
<i></i>
</em>
</li>
<li>
<a href=""> Travel Assistant </a>
</li>
<li class="have-menu">
<a href=""> Shopping Mall </a>
<em class="arrow">
<b></b>
<i></i>
</em>
</li>
<li class="have-menu">
<a href=""> The hotel · Home stay </a>
<em class="arrow">
<b></b>
<i></i>
</em>
</li>
<li>
<a href=""> Special rate hotel </a>
</li>
</ul>
3、 ... and 、 Set the absolute positioning and other elements for the three boxes
By setting the relative positioning of the three box parent boxes , Set absolute positioning and different colors for the three boxes , Three boxes can be stacked . External box em At the bottom , Two i,b The box is on the same floor .
Source code :
.site-head .topbar .shortcut-links>ul>li.have-menu{
padding-right: 12px;
position: relative;
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow{
height:12px;
width:12px;
position:absolute;
top:50%;
margin-top: -6px;
background-color: orange;
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow b{
position: absolute;
height:6px;
width:6px;
background-color:red;
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow i{
position: absolute;
height:6px;
width:6px;
background-color:rebeccapurple;
}
design sketch :![]()
Four 、 rotate , Change the background color , Micromodule box left and top value .
We will find that the inner two boxes are not in the middle of the outer box , It would be ugly , So first fine tune left,top It's worth keeping him at the parent level arrow Right in the middle of the box . This is still wrong , Because if you move the other box up , It forms purple or red rectangular lines .
therefore i,b The box needs to be rotated 45°, To reach the sharp corner of the square down . Delete the background color of the parent box , The sub boxes are body Background color and white , You can simulate a line triangle .
All of the code :
.site-head .topbar .shortcut-links>ul>li.have-menu{
padding-right: 12px;
position: relative;
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow{
height:12px;
width:12px;
position:absolute;
top:50%;
margin-top: -6px;
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow b{
position: absolute;
height:6px;
width:6px;
background-color:white;
left:3px;
top:2.5px;
transform: rotate(45deg);
}
.site-head .topbar .shortcut-links>ul>li.have-menu .arrow i{
position: absolute;
height:6px;
width:6px;
background-color:#383D42;
top:1px;
left:3px;
transform: rotate(45deg);
} design sketch :![]()
Of course , We can also join 3d Special effects , Let the line triangle rotate , Zoom, etc , Make the page more beautiful , More experience .
边栏推荐
- Everyone, Flink 1.13.6, mysql-cdc2.2.0, the datetime (6) class extracted
- Error encountered in SQL statement, solve
- 尝试链接数据库时出现链接超时报错,如何解决?
- Qt 6.3.1Conan软件包发布
- 2021-11-04
- The same node code will cause duplicate data
- idea灰屏问题
- Anonymous pipeline for interprocess communication
- Redis cache avalanche, breakdown and penetration
- Cloud native -- websocket of Web real-time communication technology
猜你喜欢

基于海康EhomeDemo工具排查公网部署出现的视频播放异常问题

Day 10 data saving and loading

Grasp grpc communication framework in simple terms

Smart use of bitmap to achieve 100 million level massive data statistics

How to solve the problem of link hyperlinks when trying to link the database?

Graduation project EMS office management system (b/s structure) +j2ee+sqlserver8.0

You know AI, database and computer system

第九天 脚本与资源管理

How the FortiGate firewall rejects a port by using the local in policy policy

Do280 private warehouse persistent storage and chapter experiment
随机推荐
win10系统使用浏览器下载后,内容无故移动或删除
第十天 数据的保存与加载
Pytorch Profiler+ Tensorboard + VS Code
I get n offers in two months. I don't have any difficult interviewers here
Titanic(POJ2361)
Graduation project EMS office management system (b/s structure) +j2ee+sqlserver8.0
mysql更新数组形式的json串
oslo_ config. cfg. ConfigFileParseError: Failed to parse /etc/glance/glance-api. Conf: a solution to errors
Basic knowledge of redis
Pig-Latin (UVA492)
dotnet-exec 0.5.0 released
数据链路层详解
Day 12 advanced programming techniques
Blue Bridge Cup: magic cube rotation [Vocational group]
Error in conditional filter (if) syntax in sum function in SQL Server2005
MySQL DDL change
JS proxy
Myrpc version 5
FortiGate firewall configuration link detection link monitor and status query
2021-07-14