当前位置:网站首页>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 .
边栏推荐
- 第九天 脚本與資源管理
- FortiGate firewall and Aruze cloud tunnel interruption
- 管道实现进程间通信之命名管道
- idea灰屏问题
- JS static method
- Explain the underlying principles of JVM garbage collection in simple terms
- How to analyze and solve the problem of easycvr kernel port error through process startup?
- Basic knowledge of redis
- FortiGate creates multiple corresponding DDNS dynamic domain names for multiple ADSL interfaces
- Node red series (28): communication with Siemens PLC based on OPC UA node
猜你喜欢

【图像融合】基于交叉双边滤波器和加权平均实现多焦点和多光谱图像融合附matlab代码

Redis cache avalanche, breakdown and penetration

Linear interpolation of spectral response function

Explain the underlying principles of JVM garbage collection in simple terms

Do280 private warehouse persistent storage and chapter experiment

Machine learning notes
![[Thesis reading | deep reading] dane:deep attributed network embedding](/img/c7/60f36c2748b8cd7544b7ef14dc309e.png)
[Thesis reading | deep reading] dane:deep attributed network embedding

Named pipes for interprocess communication

Error encountered in SQL statement, solve

JS inheritance
随机推荐
进程间通信之匿名管道
Troubleshoot abnormal video playback problems in public network deployment based on Haikang ehomedemo tool
el-upload上传文件(手动上传,自动上传,上传进度)
第九天 脚本与资源管理
If you encounter problems when using spark for the first time, please ask for help
Default value of JS parameter
找到接口在表单里加参数
[fuzzy neural network prediction] water quality prediction based on fuzzy neural network, including Matlab source code
FortiGate firewall configuration log uploading regularly
How to use FME to create your own functional software
base64.c
The new paradigm of AI landing is "hidden" in the next major upgrade of software infrastructure
Sql语句遇到的错误,求解
About manipulator on Intelligent Vision Group
第九天 脚本與資源管理
【模糊神经网络预测】基于模糊神经网络实现水质预测含Matlab源码
第十天 数据的保存与加载
Myrpc version 0
oslo_ config. cfg. ConfigFileParseError: Failed to parse /etc/glance/glance-api. Conf: a solution to errors
Everyone, Flink 1.13.6, mysql-cdc2.2.0, the datetime (6) class extracted