I have a screenshot as shown below which I have to replicate in HTML/CSS. In the following screenshot I wasn't able to make colored left and right arrows in between the squares.
At this moment, I am able to replicate this in fiddle without colored left and right arrows.
The snippets of CSS code which I have used in order to make series of small squares are:
.squares .square {
width: 200px;
text-align: center;
height: 200px;
background-color: white;
border-radius: 15px;
}
Problem Statement:
I am wondering what CSS codes I should add in the fiddle so that colored left and right arrows in between the squares shows up in the fiddle.
You can do that by HTML special characters like below:
.squares {
display: flex;
justify-content: space-between;
align-items:center;
padding: 1rem;
background-color: rgb(238, 238, 238);
flex-wrap: wrap;
}
.squares .square {
width: 200px;
text-align: center;
height: 200px;
background-color: white;
border-radius: 15px;
}
.squares .square p
{
text-align: center;
vertical-align: bottom;
}
.arrows {
text-align:center;
}
.arrows span {
display:block;
font-size:48px;
line-height:32px;
color:green;
font-weight:bold;
}
.arrows span:first-child {
color:#C90;
}
<div class="squares">
<div class="square"><p>Franchise Hub Hierarchy</p><img src="https://s7.postimg.cc/jvu89zp17/Layer_30.png" alt=""/></div>
<div class="arrows">
<span>→</span>
<span>←</span>
</div>
<div class="square"><p>System wide user permissions</p><img src="https://s7.postimg.cc/6ronxc7a3/Layer_33.png" alt=""/></div>
<div class="arrows">
<span>→</span>
<span>←</span>
</div>
<div class="square"><p>Custom Corporate Branding</p><img src="https://s7.postimg.cc/wn8egkbor/Layer_46.png" alt=""/></div>
<div class="arrows">
<span>→</span>
<span>←</span>
</div>
<div class="square"><p>Configurable Workflow</p><img src="https://s7.postimg.cc/k8lmg8rwb/Layer_47.png" alt=""/></div>
<div class="arrows">
<span>→</span>
<span>←</span>
</div>
<div class="square"><p>Orders, C.R.M. and P.O.S</p><img src="https://s7.postimg.cc/9yj7h0hgb/Shape_33.png" alt=""/></div>
</div>
You can try font awesome arrows
https://fontawesome.com/icons/arrow-left?style=solid
or make arrows using CSS borders
#arrow {
width: 0;
height: 0;
border-top: 20px solid transparent;
border-left: 40px solid red;
border-bottom: 20px solid transparent;
margin-left: 20px;
}
#arrow:before {
content: "";
position: absolute;
width: 30px ;
height: 10px;
background: red;
left: 0;
top: 22px;
}
<div id="arrow"></div>
and if you want your text towards the bottom of your box, You should write <p> after <img>.
<div class="square">
<img src="https://s7.postimg.cc/jvu89zp17/Layer_30.png" alt=""/>
<p>Franchise Hub Hierarchy</p>
</div>
Here is the cure CSS and simplest solution for your problem.
I have done this for you, just add a div between every square div
<div class="arrowWrapper">
<span class="arrow redArrow"></span><br>
<span class="arrow greenArrow"></span>
</div>
and this css to your code:
.arrow {
display:block;
height: 2px;
margin: 3px 0;
width: 35px;
position: relative;
}
.arrow.redArrow {background-color: red;}
.arrow.greenArrow {background-color: green;}
.arrowWrapper { margin-right: -20px; margin-left: -20px;}
.arrow.redArrow:after{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: red;
right: -1px;
transform: rotate(45deg);
top: -4px;
}
.arrow.redArrow:before{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: red;
right: -1px;
transform: rotate(135deg);
top: 4px;
}
.arrow.greenArrow:after{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: green;
left: -1px;
transform: rotate(135deg);
top: -4px;
}
.arrow.greenArrow:before{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: green;
left: -1px;
transform: rotate(45deg);
top: 4px;
}
Complete code is in below snippetenjoy
.squares {
display: flex;
justify-content: space-between;
align-items:center;
padding: 1rem;
background-color: rgb(238, 238, 238);
flex-wrap: wrap;
}
.squares .square {
width: 200px;
text-align: center;
height: 200px;
background-color: white;
border-radius: 15px;
}
.squares .square p
{
text-align: center;
vertical-align: bottom;
}
.arrow {
display:block;
height: 2px;
margin: 3px 0;
width: 35px;
position: relative;
}
.arrow.redArrow {background-color: red;}
.arrow.greenArrow {background-color: green;}
.arrowWrapper { margin-right: -20px; margin-left: -20px;}
.arrow.redArrow:after{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: red;
right: -1px;
transform: rotate(45deg);
top: -4px;
}
.arrow.redArrow:before{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: red;
right: -1px;
transform: rotate(135deg);
top: 4px;
}
.arrow.greenArrow:after{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: green;
left: -1px;
transform: rotate(135deg);
top: -4px;
}
.arrow.greenArrow:before{
position: absolute;
content: "";
height: 2px;
width: 12px;
background: green;
left: -1px;
transform: rotate(45deg);
top: 4px;
}
<div class="squares">
<div class="square"><p>Franchise Hub Hierarchy</p><img src="https://s7.postimg.cc/jvu89zp17/Layer_30.png" alt=""/></div>
<div class="arrowWrapper">
<span class="arrow redArrow"></span><br>
<span class="arrow greenArrow"></span></div>
<div class="square"><p>System wide user permissions</p><img src="https://s7.postimg.cc/6ronxc7a3/Layer_33.png" alt=""/></div>
<div class="square"><p>Custom Corporate Branding</p><img src="https://s7.postimg.cc/wn8egkbor/Layer_46.png" alt=""/></div>
<div class="square"><p>Configurable Workflow</p><img src="https://s7.postimg.cc/k8lmg8rwb/Layer_47.png" alt=""/></div>
<div class="square"><p>Orders, C.R.M. and P.O.S</p><img src="https://s7.postimg.cc/9yj7h0hgb/Shape_33.png" alt=""/></div>
</div>
Related
I'm trying to make some arrows like the following
arrows
I am using Sass and Bootstrap4 and I want to make them by drawing them with css3
I've tried this, but I don't know how to achieve it:
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
<div class="col-md-3 align-items-center mr-0">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
</div>
</div>
I come from the future and you managed to do it like this:
.line-container{
border-bottom: 5px solid red;
border-right: 5px dashed red;
}
.line-container::before{
content:"";
// display:block;
position: absolute;
height: 20px;
width:20px;
border-radius:50%;
background: red;
bottom:-7px;
left:0;
}
.line-container::after{
content:"2";
position:absolute;
width:55px;
height:55px;
border-radius:50%;
background: red;
bottom:-25px;
right:-7px;
font-size:2rem;
font-weight:700;
color:#fff;
text-align:center;
}
.line-container p::before{
content:"➤";
position:absolute;
font-size:32px;
color:red;
right:2.6px;
top:-30px;
transform: rotate(270deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-8 mt-5">
<div class="line-container px-md-5 pt-5">
<p class="mt-5" >Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta minus </p>
</div>
</div>
You only need to use the 'lines' of the rectangles of the containers, they already exist so you only need to put color
I was able to find the initial css for a triangle here. Basically you want to make two borders of a div transparent and give them a certain width so it appears to pinch the div into a triangle. I also added the ball which was pretty straightforward aside from positioning.
You may want to make further adjustments to fit your needs but this should get you started :)
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
.arrow1{
position: absolute;
transform: rotate(180deg);
left: 3px;
top: 225px;
width: 0;
height: 0;
border-right: 28px solid transparent;
border-bottom: 60px solid red;
border-left: 28px solid transparent;
}
.ball1{
position: absolute;
left: 300px;
top: 15px;
background-color: red;
border-radius: 50%;
height: 50px;
width: 50px;
}
<div class="col-md-3 align-items-center mr-0" style="position: relative;">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
<div class='arrow1'></div>
<div class='ball1'></div>
</div>
</div>
Well, I'll give you a quick PoC you could easily expand on so its use could be defined for the instance with pre-made templates but if you want all other directions and stuff you'll have to do the extra creative work and fill in the blanks on your own but this might help get you started. Cheers!
.magic-arrows {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: var(--arrow-circle-height);
width: var(--arrow-circle-width);
background-color: var(--arrow-color);
border-radius: 50%;
overflow: visible;
}
.magic-arrows:before, .magic-arrows:after {
content: '';
display: block;
position: absolute;
color: var(--arrow-color);
border: var(--arrow-color) var(--arrow-dash-size) dashed;
overflow: visible;
z-index: -1;
}
.magic-arrows:before {
height: 0;
width: calc( var(--arrow-circle-width) + var(--arrow-width) );
left: var(--arrow-circle-width);
top: 50%;
transform: translateY(-50%);
}
.magic-arrows:after {
width: 0;
height: calc( var(--arrow-circle-width) + var(--arrow-width) );
top: var(--arrow-circle-width);
left: 50%;
transform: translateX(-50%);
}
.magic-arrows .arrow-right, .magic-arrows .dot-down {
position: absolute;
font-size: var(--arrow-size);
color: var(--arrow-color);
}
.magic-arrows .arrow-right {
top: 50%;
left: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateY(-55%);
}
.magic-arrows .dot-down {
position: absolute;
left: 50%;
top: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateX(-55%) rotate(90deg);
}
<div class="magic-arrows"
style="--arrow-color: red;
--arrow-circle-height: 3rem;
--arrow-circle-width: 3rem;
--arrow-width: 10rem;
--arrow-dash-size: 5px;
--arrow-size: 2rem;">
<span>3</span>
<div class="arrow-right">➤</div>
<div class="dot-down">◉</div>
</div>
i have a box and i need to put smooth triangle bottom of the div but i couldn't achieve as i want how can i do this like below image ?
.slide-box {
position: relative;
display: inline-block;
background: #e41113;
border: 1px solid #df2b2c;
border-radius: 6px;
}
.slide-box a {
display: block;
color: #fff;
text-decoration: none;
padding: 12px 10px;
}
.slide-box:after {
content: '';
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
height: 0;
border-top: 25px solid #df2b2c;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
<div class="slide-box">
<a href="#">
I'm a super <br>box!
</a>
</div>
I'm not sure that you'll be able to complete what you want with ::after.
But probably you can use transition rotate and scale on absolute positioned element in the bottom.
Here's the concept:
.slide-box {
position: relative;
display: inline-block;
background: #e41113;
border: 1px solid #df2b2c;
border-radius: 6px;
width: 145px;
height: 70px;
}
.slide-box a {
display: block;
color: #fff;
background: #e41113;
display: block;
text-decoration: none;
padding: 12px 10px;
z-index:1000;
}
.slide-box .corner {
position: absolute;
top: 70px;
left: 0px;
width: 103px;
height: 103px;
background-color: #e41113;
transform-origin: top left;
transform: scale(1, 0.25) rotate(-45deg);
border-radius: 6px;
}
<div class="slide-box">
<a href="#">
I'm a super <br>box!
</a>
<div class="corner"></div>
</div>
Of course the main task will be positioning.
So there you need 2 prerequisitions:
With "transform-origin: top left;" you need to keep top of the .corner == height of your main container (don't know why, but bottom:0 not works, maybe youll resolve
this)
The .corner should be square (width=height), and to keep it smooth you need to maintain ratio width(.corner) = width(.slide-box)*sqrt(2). Means width of your corner`s diagonal should be equal to width of main container.
Here is a way to do:
.container {
width: 300px;
}
.slide-box {
height: 200px;
width: 100%;
position: relative;
background-color: #df2b2c;
text-align: left;
margin-left: 70px;
margin-bottom: -75px;
border-radius: 0 0 25% 25%;
}
.slide-box a {
display: block;
color: #fff;
text-decoration: none;
padding: 12px 10px;
}
.corner {
position: relative;
background-color: #df2b2c;
text-align: left;
margin-left: 95px;
}
.corner:before,
.corner:after {
content: '';
position: absolute;
background-color: inherit;
}
.corner,
.corner:before,
.corner:after {
width: 165px;
height: 165px;
border-top-right-radius: 30%;
}
.corner {
transform: rotate(-120deg) skewX(-30deg) scale(1,.866);
}
.corner:before {
transform: rotate(-135deg) skewX(-45deg) scale(1.414,.707) translate(0,-50%);
}
.corner:after {
transform: rotate(135deg) skewY(-45deg) scale(.707,1.414) translate(50%);
}
<div class="container">
<div class="slide-box">
<a href="#">
I'm a super <br>box!
</a>
</div>
<div class="corner"></div>
</div>
Below is the image I am trying for; I managed to get a rectangle using CSS, but I am trying for a rectangle above another one .
#dragtarget2 {
float: left;
clear: left;
width: 176px;
height: 76px;
background: #968282;
border-radius: 13px;
}
<div ondragstart="dragStart(event)" draggable="true" id="dragtarget2">
<p>meter</p>
</div>
Make your rectangles position: absolute and the container as position: relative.
This is the code you're looking for.
.container{
position: relative;
}
.first , .second, .third {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 40px;
background-color: gray;
border-radius: 4px;
border: 2px solid red;
}
.second{
top: 4px;
left: 4px;
}
.third{
top: 8px;
left: 8px;
}
<div class="container">
<div class="first"></div>
<div class="second"></div>
<div class="third"></div>
</div>
Use position: absolute/position: relative to move element from it's origin position. Use z-index to move element above/below other elements (higher z-index - higher element is positioned).
.border {
border: 2px solid red;
background-color: #aaa;
width: 200px;
height: 50px;
line-height: 50px;
position: absolute;
left: 0;
top: 0;
z-index: 5;
}
.border:nth-child(2) {
left: 5px;
top: 5px;
z-index: 6;
}
.border:nth-child(3) {
left: 10px;
top: 10px;
z-index: 7;
}
.wrapper {
margin: 10px;
/* NOTE: this does not effect absolute elements */
padding: 10px;
/* NOTE: this will be origin of absolute elements coordinates */
position: relative;
}
<div class="wrapper">
<div class="border">1</div>
<div class="border">2</div>
<div class="border origin">SmartMeter</div>
</div>
With less HTML:
.wrapper {
position: relative;
margin: 10px;
}
.border {
position: relative;
}
.border span,
.border:before,
.border:after {
content: '';
position: absolute;
left: 0;
top: 0;
border: 2px solid red;
background: #aaa;
display: inline-block;
width: 200px;
height: 50px;
line-height: 50px;
}
.border:after {
left: 5px;
top: 5px;
z-index: 6;
}
.border span {
left: 10px;
top: 10px;
z-index: 7;
}
<div class="wrapper">
<div class="border"><span>SmartMeter</span>
</div>
</div>
I have added two outer divs so that the code is as follows.
#dragtarget2 {
float: left;
clear: left;
width: 176px;
height: 76px;
background: #968282;
border-radius: 13px;
border: 2px solid;
padding: 2px;
}
.dragtarget0 {
float: left;
clear: left;
width: 176px;
height: 76px;
border: 2px solid;
border-radius: 13px;
padding: 2px;
margin: 2px;
}
.dragtarget1 {
float: left;
clear: left;
width: 176px;
height: 76px;
border: 2px solid;
border-radius: 13px;
padding: 3px;
}
<div class="dragtarget0">
<div class="dragtarget1">
<div id="dragtarget2">
<p>meter</p>
</div>
</div>
</div>
I have icons that I want centered both horizontally and vertically.
See codepen and snippet below:
div {
border: 1px solid black;
}
.icon-placeholder {
height: 34px;
overflow: hidden;
width: 34px;
}
.icon {
color: hotpink;
font-size: 400%;
}
.icon::before {
content: '+';
}
<div class="icon-placeholder">
<span class="icon"></span>
</div>
How can I do that regardless of .icon's font size.
I have tried transform, position: absolute, display: table with no luck. I can't use flex.
You can achieve it using transform and absolute positioning
div {
border: 1px solid black;
margin: 10px;
}
.icon-placeholder {
height: 34px;
overflow: hidden;
width: 34px;
position: relative;
}
.icon {
color: hotpink;
font-size: 400%;
margin-top: -10%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
left: 50%;
}
.icon::before {
content: '+';
}
.plus-symbol{
font-size: 400%;
outline: dotted 1px red;
color: hotpink;
}
.left, .right{
width: 45%;
padding: 20px;
box-sizing: border-box;
}
.left{
float: left;
}
.right{
float: right;
}
.custom-plus-icon, .custom-plus-icon:before{
position: absolute;
width: 10%;
border-radius: 1px;
background-color: hotpink;
height: 80%;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.custom-plus-icon:before{
content: '';
width: 100%;
height: 100%;
transform: rotate(90deg);
}
<div class="left">
<h3>Plus symbol using font</h3>
<span class="plus-symbol">+</span>
<br/>
<br/>
<label>Font-size : 400%</label>
<div class="icon-placeholder">
<span class="icon"></span>
</div>
<label>Font-size : 300%</label>
<div class="icon-placeholder">
<span class="icon" style="font-size: 300%;"></span>
</div>
<label>Font-size : 200%</label>
<div class="icon-placeholder">
<span class="icon" style="font-size: 200%;"></span>
</div>
<label>Font-size : 100%</label>
<div class="icon-placeholder">
<span class="icon" style="font-size: 100%;"></span>
</div>
</div>
<div class="left">
<h3>Plus symbol using pseudo element</h3>
<div class="icon-placeholder">
<span class="custom-plus-icon"></span>
</div>
</div>
On thing to note though, a + isn't necessarily centered in the first place depending on the font.
div {
border: 1px solid black;
}
.icon-placeholder {
height: 34px;
overflow: hidden;
position: relative;
width: 34px;
}
.icon {
color: hotpink;
font-size: 400%;
}
.icon::before {
content: '0';
display: inline-block;
position: absolute;
right: 50%;
bottom: 50%;
transform: translate(50%, 50%);
}
<div class="icon-placeholder">
<span class="icon"></span>
</div>
The following is my markup:
.play-controls {
.fa-play, .fa-pause {
font-size: 25px;
}
}
.volume-controls {
display: inline-block;
position: relative;
.overlay {
background-color: $highlight;
height: 10px;
border-radius: 5px;
width: 0px;
position: absolute;
z-index: 15;
}
.background {
background-color: $text-color;
width: 100px;
height: 10px;
border-radius: 5px;
position: absolute;
z-index: 10;
}
.circle {
border-radius: 100%;
position:absolute;
background-color: #fff;
border: 1px solid;
height: 15px;
width: 15px;
z-index: 20;
top: -3px;
}
}
.player {
#album-artwork {
width: 80px;
height: 80px;
vertical-align: middle;
display:inline-block;
margin-right: 10px;
}
.wrapper {
display:inline-block;
.information {
margin-bottom: 5px;
#song-title {
font-size: 22px;
font-weight:bold;
margin-right: 5px;
}
#artist-album {
font-size: 18px;
}
}
.progress-bar {
position: relative;
.overlay {
background-color: $highlight;
height: 10px;
border-radius: 5px;
width: 0px;
position: absolute;
z-index: 15;
}
.background {
background-color: $text-color;
width: 600px;
height: 10px;
border-radius: 5px;
position: absolute;
z-index: 10;
}
.circle {
border-radius: 100%;
position:absolute;
background-color: #fff;
border: 1px solid;
height: 15px;
width: 15px;
z-index: 20;
top: -3px;
}
}
}
}
<div class="play-controls">
<i class="fa fa-play" id="playpause"></i>
</div>
<div class="volume-controls">
<div class="background"></div>
<div class="circle"></div>
<div class="overlay"></div>
</div>
<div class="player">
<img id="album-artwork" src="build/images/guero.jpg">
<div class="wrapper">
<div class="information">
<span id="song-title">Go It Alone</span>
<span id="artist-album">Beck - Guero</span>
</div>
<div class="progress-bar">
<div class="background"></div>
<div class="circle"></div>
<div class="overlay"></div>
</div>
</div>
</div>
The divs with classes background, circle, and overlay in volume-controls are all position: absolute; with volume-controls as position: relative;.
Upon making play-controls, volume-controls, and player inline, play-controls is inline with volume-controls, but volume-controls is overlapping the player.
How would I be able to set everything in one line, without any overlapping?
EDIT: JSFiddle
You could float:left; the 3 main parts or display:inline-block; them the issue the player is over the volume-controls is because of the absolute positioned elements in the volume-controls. You could add a width to volume-controls.
.volume-controls {
display: inline-block;
position: relative;
width:150px;
}
Here is the fiddle