css - How to Stick the arrow icon to line -
am trying make border css below has small triangle icon css needs centered border line of div. if use float:right
or left arrow icon goes either end of border line, can make center , if possible stick border line responsive design.
.center { text-align: center; border: 3px solid green; } .arrow-down { width: 0; height: 0; border-left: 10px solid rgba(30, 7, 7, 0); border-right: 10px solid transparent; border-top: 10px solid #f00; }
<!doctype html> <html> <head> </head> <body> <div class="center"> <p>this text centered.</p> </div> <div class="arrow-down"></div> <div class="center"> <p>this second text centered.</p> </div> <div class="arrow-down"></div> <div class="center"> <p>this third text centered.</p> </div> <div class="arrow-down"></div> </body> </html>
you can set margin-left: 50%
bring center, , set margin-top: -3px
move on border of previous element.
.center { text-align: center; border: 3px solid green; } .arrow-down { width: 0; height: 0; border-left: 10px solid rgba(30, 7, 7, 0); border-right: 10px solid transparent; border-top: 10px solid #f00; margin-top: -3px; margin-left: 50%; }
<div class="center"> <p>this text centered.</p> </div> <div class="arrow-down"></div> <div class="center"> <p>this second text centered.</p> </div> <div class="arrow-down"></div> <div class="center"> <p>this third text centered.</p> </div> <div class="arrow-down"></div>
Comments
Post a Comment