Ich versuche, eine Fortschrittspfeil-Leiste zu erstellen, die ähnlich wie das Bild oben aussieht. Ich habe mit einer Kolumne angefangen (vier col-sm-4) und weiß nicht, wohin ich von dort gehen soll.Erstellen Sie eine Pfeilleiste in HTML/CSS/JS
0
A
Antwort
3
machte ich (inspiriert von this post) ein div mit der Form, die Sie wollen:
.container{
width: 100%;
position: relative;
display: flex;
flex-direction: row;
}
.v-div {
width: 0;
height: 0;
border-bottom: 40px solid transparent;
border-top: 40px solid transparent;
border-left: 25px solid #f00;
}
.box{
height: 80px;
width: 320px;
background: red;
}
<div class="container">
<div class="box">
</div>
<div class="v-div">
</div>
</div>
Haben Sie ein paar von ihnen überlappen, und Sie sollten gut zu gehen!
1
Eine Lösung mit: before und: after
.arrow {
font-size: 0;
}
.inner-arrow {
\t width:210px;
\t height:80px;
display: inline-block;
\t background-color:green;
\t text-align:center;
\t font-size:20px;
\t font-weight:bold;
\t line-height:80px;
vertical-align: middle;
}
.arrow:before,
.arrow:after {
\t content:'';
display: inline-block;
\t width:0;
\t height:0;
\t border:40px solid transparent;
vertical-align: middle;
}
.arrow:before {
\t border-top-color: green;
\t border-bottom-color: green;
\t border-right-color: green;
}
.arrow:after {
\t border-left-color: green;
}
<div class="arrow">
<div class="inner-arrow">Next step</div>
</div>
1
Sie können dies erreichen, indem CSS Pseudo-Elemente mit :before
und after
.
Überprüfen Sie den folgenden Code-Schnipsel:
ul{
padding:0;
list-style-type: none;
border:1px solid #ccc;
}
ul:before,ul:after{
content:"";
display:table;
}
ul:after{
clear:both;
}
ul li {
display: inline-block;
width: 25%;
float: left;
text-align: center;
text-transform: uppercase;
font-size: 10px;
font-family: sans-serif;
}
ul li.active {
background: forestgreen;
color: #fff;
}
ul li a {
padding: 0 12px;
height: 40px;
line-height: 40px;
position: relative;
display: block;
}
ul li.active a:before,ul li.active a:after{
content: "";
position: absolute;
border-style: solid;
border-color: transparent transparent transparent white;
border-width: 20px;
left: 0px;
}
ul li.active a:after{
content: "";
right: -40px;
left: auto;
border-color: transparent transparent transparent forestgreen;
}
ul li.active a {
padding-left: 30px;
}
<ul>
<li><a>job post</a></li>
<li class="active"><a>invite</a></li>
<li><a>review</a></li>
<li><a>hire</a></li>
</ul>
Verwandte Themen
- 1. Erstellen Sie eine Matrix
- 2. Erstellen Sie eine JsonProcessingException
- 3. Erstellen Sie eine benutzerdefinierte Farbpalette in R
- 4. erstellen Sie eine leere BitmapSource in C#
- 5. So erstellen Sie eine Konstante in Javascript
- 6. Erstellen Sie eine transparente Farbe in PDF
- 7. So erstellen Sie eine Protokolldatei in SSIS
- 8. So erstellen Sie eine Energieleiste in JavaScript
- 9. Erstellen Sie eine verschachtelte Komponente in React
- 10. Wie erstellen Sie eine Erweiterung in C#?
- 11. So erstellen Sie eine Linie in StarUML
- 12. Erstellen Sie eine Website in jQuery allein?
- 13. So erstellen Sie eine Schattentabelle in Informix
- 14. Erstellen Sie eine GUI in Matlab
- 15. Erstellen Sie eine Pygit-Build in GitLab
- 16. Erstellen Sie eine Liste/Array in XSLT
- 17. Erstellen Sie eine Menüleiste in WPF?
- 18. So erstellen Sie eine NewsML in C#
- 19. Erstellen Sie eine Cabinet-Datei in Java
- 20. So erstellen Sie eine Suchmaschine in C#
- 21. Erstellen Sie eine kombinierte Grafik in Pygal?
- 22. Erstellen Sie eine Testumgebungsdatenbank in Ruby
- 23. So erstellen Sie eine Rotationsmatrix in Tensorflow
- 24. Erstellen Sie eine Artikelliste in PHP
- 25. Erstellen Sie eine geordnete Menge in F #
- 26. Erstellen Sie eine Eigenschaft Writer in SOLR
- 27. Erstellen Sie eine Tabelle in der Datenbank
- 28. So erstellen Sie eine Unterabfrage in Grails
- 29. Erstellen Sie eine leere Abfrage in Slick
- 30. Erstellen Sie eine weiße Seite in WordPress
können Sie auch: vor und: nach pseudo-Elemente anstelle eines zusätzlichen V-div –