How is an arrow displayed in the demo box above?
This CSS code styles a container with the class .demo-content
and uses the ::after
pseudo-element to add a decorative arrow (▼), which is a UTF-8 character representing a downward-pointing triangle.
CSS
.demo-content {
position: relative;
background-color: #000;
color: #fff;
padding: 10px 20px;
border-radius: 6px;
}
.demo-content::after {
position: absolute;
font-size: 2em;
color: #000;
content: "▼";
top: 23px;
left: 50%;
}
HTML
<div class="demo-content">This is a demo box</div>
Explanation of the CSS Code
.demo-content
position: relative;
– Sets up a positioning context for the::after
element.background-color: #000;
– Applies a black background.color: #fff;
– Makes the text white.padding: 10px 20px;
– Adds space inside the element.border-radius: 6px;
– Rounds the corners.
.demo-content::after
position: absolute;
– Positions the triangle relative to.demo-content
.font-size: 2em;
– Makes the triangle larger.color: #000;
– Sets the triangle color to black.content: "▼";
– Inserts the UTF-8 character (downward triangle).top: 23px;
– Positions the triangle below the main box.left: 50%;
– Centers it horizontally.
Arrow at the bottom
Arrow at the bottom with a utf-8 character
Arrow at the top of a container
Aside
Background color
Blackboard design
Breadcrumbs design
Calendar design
Checkboxes as circular buttons
Checkboxes as toggle switches
Cursor properties
Circular image with a shadow effect
Font Awesome pulled icons
Gallery picture frame with a price ribbon
Google pie chart
Google web fonts
Last child and not last child element
Letter spacing
List items with a Font Awesome icon
Neon text
Neon text with a flickering effect
Notebook paper background
Radio buttons as circular buttons
Radio buttons as rating stars
Remove the glow effect from an input field
Search bar with categories
Track (audio/video subtitles)
Web fonts
Whiteboard design