How to add vertical separator between links in one button? - html

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<a class="btn btn-primary"><i class="fa fa-angle-left"></i> 1</a>
<a class="btn btn-primary">2 <i class="fa fa-angle-right"></i></a>
</body>
</html>
I have two bootstrap buttons with icons <,>.I wanna make them together like one button and put a vertical separator '|' like this below
To achieve this I tried different things but couldn't get the desired one.

You can try the vertical line by using :before and positioning it to the place.
I've created a little example, it might help you.
HTML
<div class="button-wrapper">
<button><1</button>
<button class="last-btn">2></button>
</div>
CSS
.button-wrapper{
display: flex;
}
.last-btn:before {
content: '';
position: absolute;
top: 50%;
height: 50%;
background: white;
width: 1px;
left: 0px;
transform: translateY(-50%);
}
button{
padding: 5px 10px;
border: 0;
position: relative;
background: skyblue;
color: #ffffff;
}
https://codepen.io/ammar-d/pen/XWderxm

You could use Button-Groups and CSS-Pseudo-Elements like :after
It's not perfect but I think it should do the trick :-)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.btn-group > .btn{ position:relative;}
.btn-group > .btn:after{
position:absolute; right:0; top: 50%;
transform:translateY(-50%);
content:''; width: 1px; height:1.25em;
background-color:currentColor;
}
.btn-group > .btn:last-child:after{ content:none;}
</style>
</head>
<body>
<div class="btn-group">
<a class="btn btn-primary"><i class="fa fa-angle-left"></i> 1</a>
<a class="btn btn-primary">2 <i class="fa fa-angle-right"></i></a>
</div>
</body>
</html>

Some flexbox and psuedo-element magic make it happen :-)
.wrapper {
display: flex;
overflow: hidden;
border-radius: 5px;
font-family: Helvetica;
color: white;
width: 80px;
position: relative;
}
.wrapper::after {
content: "";
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 1px;
background: white;
height: 60%;
}
.btn {
background: #0a48ff;
padding: 7px;
width: 50%;
text-align: center;
cursor: pointer;
transition: background 0.2s;
}
.btn:hover {
background: #0a48ffdd;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="wrapper">
<div class="btn btn-left"><i class="fa fa-angle-left"></i> 1</div>
<div class="btn btn-right">2 <i class="fa fa-angle-right"></i></div>
</div>

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<style>
.left {
border-top-right-radius: 0rem;
border-bottom-right-radius: 0rem;
}
.right {
border-top-left-radius: 0rem;
border-bottom-left-radius: 0rem;
}
.separator {
display: inline-block;
color: #d8d8d8;
vertical-align: middle;
border: 1px solid transparent;
padding: 0.375rem 0.15rem;
font-size: 1rem;
line-height: 1.5;
background-color: #007bff;
}
</style>
</head>
<body>
<a class="btn btn-primary left"><i class="fa fa-angle-left"></i> 1</a
><span class="separator">|</span
><a class="btn btn-primary right">2 <i class="fa fa-angle-right"></i></a>
</body>
</html>

Here is another solution.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<style>
.left {
border-top-right-radius: 0rem;
border-bottom-right-radius: 0rem;
}
.right {
border-top-left-radius: 0rem;
border-bottom-left-radius: 0rem;
}
.left::after {
content: "";
position: absolute;
top: 20%;
left: 50%;
height: 60%;
background: rgba(255, 255, 255, 0.6);
width: 2px;
margin-left: -1px;
z-index: 10;
}
.wrap {
position: relative;
display: inline-block;
}
</style>
</head>
<body>
<div class="wrap">
<a class="btn btn-primary left"><i class="fa fa-angle-left"></i> 1</a
><a class="btn btn-primary right">2 <i class="fa fa-angle-right"></i></a>
</div>
</body>
</html>

Related

Can't position button element

I created a submit button using bootstrap but I want to place it where the arrow pointing but I no matter what I write the position doesn't change it's like the button stick to the position and I can't reposition it
how can I place it to be there?
.container {
position: absolute;
top: 30%;
left: 30%;
transform: translate(-50%, -50%);
text-align: center;
/*give the text bolder font*/
font-weight: bold;
}
/*set the input under the span element*/
input[type=text] {
text-align: center;
font-weight: bold;
font-size: 20px;
border: 2px solid #ccc;
border-radius: 4px;
padding: 12px 10px;
width: 100%;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
/*set the space from left to 30%*/
margin-left: 30%;
}
/* set the button under the input element*/
button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
/*set the space from left to 30%*/
margin-left: 30%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>quiz</title>
<link rel="stylesheet" href="quiz2.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<span id="question">What type of file do you need to open javascript file ?</span>
<div class="input-group flex-nowrap">
<input type="text" id="answer" class="form-control" placeholder="Answer Here..." aria-label="Username" aria-describedby="addon-wrapping">
</div>
<button type="button" id="submit" class="btn btn-outline-success">Submit</button>
</div>
If you're able to change the HTML, here's a way:
Wrap your button inside another div:
<div class="button-wrapper">
<button type="button" id="submit" class="btn btn-outline-success">Submit</button>
</div>
Then set the margin-left on that wrapper:
.button-wrapper {
/*set the space from left to 30%*/
margin-left: 30%;
}
Check this snippet for the result.
.container {
position: absolute;
top: 30%;
left: 30%;
transform: translate(-50%, -50%);
/*give the text bolder font*/
font-weight: bold;
}
/*set the input under the span element*/
input[type=text] {
text-align: center;
font-weight: bold;
font-size: 20px;
border: 2px solid #ccc;
border-radius: 4px;
padding: 12px 10px;
width: 100%;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
/*set the space from left to 30%*/
margin-left: 30%;
}
/* set the button under the input element*/
button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.button-wrapper {
/*set the space from left to 30%*/
margin-left: 30%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>quiz</title>
<link rel="stylesheet" href="quiz2.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<span id="question"></span>
<div class="input-group flex-nowrap">
<input type="text" id="answer" class="form-control" placeholder="Answer Here..." aria-label="Username" aria-describedby="addon-wrapping">
</div>
<div class="button-wrapper">
<button type="button" id="submit" class="btn btn-outline-success">Submit</button>
</div>
</div>
I just define a button-container class and use flex & justify:
.container {
position: absolute;
top: 30%;
left: 30%;
transform: translate(-50%, -50%);
text-align: center;
/*give the text bolder font*/
font-weight: bold;
}
/*set the input under the span element*/
input[type=text] {
text-align: center;
font-weight: bold;
font-size: 20px;
border: 2px solid #ccc;
border-radius: 4px;
padding: 12px 10px;
width: 100%;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
/*set the space from left to 30%*/
margin-left: 30%;
}
/* set the button under the input element*/
button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
/*set the space from left to 30%*/
margin-left: 30%;
}
.button-container {
display: flex;
justify-content: start;
margin-left: 30%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>quiz</title>
<link rel="stylesheet" href="quiz2.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<span id="question">What type of file do you need to open javascript file ?</span>
<div class="input-group flex-nowrap">
<input type="text" id="answer" class="form-control" placeholder="Answer Here..." aria-label="Username" aria-describedby="addon-wrapping">
</div>
<div class="button-container">
<button type="button" id="submit" class="btn btn-outline-success">Submit</button>
</div>
</div>

Frontend - HTML Files

*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
position: relative;
}
/*---------------------Dashboard-----------------------*/
.dashboard{
position: relative;
width: 100%;
min-height: 100vh;
}
/*--------------------Dashboard Sidebar Begin-----------------------*/
.dashboard-sidebar{
position: fixed;
width: 50px;
min-height: 100vh;
background-color: #2E86C1;
color: white;
padding: 15px 6px;
}
.dashboard-sidebar .dashboard-sidebar-top{
position: relative;
width: 100%;
min-height: 100vh;
justify-content: center;
display: flex;
}
.dashboard-sidebar-top i{
font-size: 17px;
}
/*-----------------------Dashboard Sidebar End--------------------*/
/*--------------------Dashboard Main Content Start----------------------*/
.dashboard-main-content{
position: absolute;
width: calc(100% - 50px);
height: 100vh;
left: 50px;
padding: 10px 15px;
}
.dashboard-main-content .dashboard-app{
position: relative;
background-color: white;
width: 70px;
height: 70px;
border-radius: 6px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
cursor: pointer;
}
.dashboard-main-content .dashboard-app:hover{
background-color: #EBEDEF;
}
.dashboard-main-content .dashboard-app i{
font-size: 30px;
color: #2874A6
}
.app-name{
font-size: 12px;
font-family: tahoma, sans-serif;
color: #2874A6
}
/*--------------------Dashboard Main Content End----------------------*/
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<link rel="stylesheet" href="dashboard.css">
<!-- Boxicons CDN Link -->
<link href='https://unpkg.com/boxicons#2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="dashboard"><!--Dashboard begin-->
<div class="dashboard-sidebar"><!--Dashboard sidebar begin-->
<div class="dashboard-sidebar-top">
<i class="bx bxs-dashboard"></i>
</div>
</div><!--Dashboard sidebar end-->
<div class="dashboard-main-content"><!--Dashboard contents begin-->
<div class="dashboard-app"><!--App begin-->
<i class="bx bx-laptop"></i>
<div class="app-name">
<span>Begin Design</span>
</div>
</div><!--App end-->
</div> <!--Dashboard contents end-->
</div><!--Dashboard end-->
<script src="script.js"></script>
</body>
</html>
I have the following dashboard layout. The dashboard has the Begin Design dashboard app which will have many sub components of its own and will have a separate html file called begin-design.html. When the use clicks on it, it will take the user to the design app components. My question is, how can I go about bringing thebegin-design.html app into the dashboard.html file rather than writing the entire begin-design.htmlcomponents in the dashboard.html file? I would like to keep all the components in seperate html files and connect eachother together.
****HTML****
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<link rel="stylesheet" href="dashboard.css">
<!-- Boxicons CDN Link -->
<link href='https://unpkg.com/boxicons#2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="dashboard"><!--Dashboard begin-->
<div class="dashboard-sidebar"><!--Dashboard sidebar begin-->
<div class="dashboard-sidebar-top">
<i class="bx bxs-dashboard"></i>
</div>
</div><!--Dashboard sidebar end-->
<div class="dashboard-main-content"><!--Dashboard contents begin-->
<div class="dashboard-app"><!--App begin-->
<i class="bx bx-laptop"></i>
<div class="app-name">
<span>Begin Design</span>
</div>
</div><!--App end-->
</div> <!--Dashboard contents end-->
</div><!--Dashboard end-->
<script src="script.js"></script>
</body>
</html>
<a href="begin-design.htmk"><i class="bx bx-laptop"></i>
<div class="app-name">
<span>Begin Design</span>
</div></a>

How can I center my icons in the middle of the page and place the text under the icons?

How can I center my icons in the middle of the page and place the text under the icons?
I tried 4 hours and it didn't work ; It would be great if it were based on the Flex box and in the middle of the DIV,
<pre>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght#200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<style>
.row{
display: flex; /* مهمة */
justify-content: space-between;
.servics{
height: 100%;
width: 100%;
padding-top: 2%;
text-align: center;
margin: 10% auto;
/* https://www.youtube.com/watch?v=wfaDzSL6ll0 */
}
.icons{
display: flex;
}
.child{
width: 150px;
height: 150px;
background-color: transparent;
border: 4px solid #87CEEB;
border-radius: 100%;
font-size: 50px;
text-align: center;
}
.icon1, .icon2, .icon3, .icon4{
color: rosybrown;
line-height: 150px;
}
</style>
</head>
<body>
<section class="servics">
<h1>Unsere Leistungen</h1>
<div class="row">
<div class="icons">
<div class="child icon1"> <i class="fas fa-heart"></i> Same </div>
<div class="child icon2"> <i class="fas fa-heart"></i> Sam </div>
<div class="child icon3"> <i class="fas fa-heart"></i> Equar </div>
<div class="child icon4"> <i class="fas fa-heart"></i> Isma</div>
</div>
</div>
</section>
</body>
</html>
</pre>
The following code might help
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght#200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<style>
.servics{
height: 100%;
width: 100%;
padding-top: 2%;
text-align: center;
margin: 10% auto;
/* https://www.youtube.com/watch?v=wfaDzSL6ll0 */
}
.icons{
display: flex;
justify-content: center;
}
.child{
width: 150px;
height: 150px;
background-color: transparent;
border: 4px solid #87CEEB;
border-radius: 100%;
font-size: 50px;
text-align: center;
}
.icon1, .icon2, .icon3, .icon4{
color: rosybrown;
line-height: 150px;
}
</style>
</head>
<body>
<section class="servics">
<h1>Unsere Leistungen</h1>
<div class="icons">
<div class="child icon1"> <i class="fas fa-heart"></i> Same </div>
<div class="child icon2"> <i class="fas fa-heart"></i> Sam </div>
<div class="child icon3"> <i class="fas fa-heart"></i> Equar </div>
<div class="child icon4"> <i class="fas fa-heart"></i> Isma</div>
</div>
</div>
</section>
</body>
</html>
for put any thing in middle of the page you can use >>
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
and is one more way to put text under icon ,
use ur border style on i tag :)
looc at this >>
.ur-icon{
border: & & &;
border-radius: &;
}
looc ^^^ i used border style in icon not div(child icon#)
and after u can put with and height
and for spaces use padding / margin
have nice time . 👋😀
Try this one: its flex layout method. In the past it was a struggle to center page to the middle, nowadays it's changed. Remove all your code in style and replace with the code below:
/* CSS */
body{
display: flex;
justify-content: center;
background: orange;
align-items: center;
height: 100vh;
}
.icons *{
display: inline-block;
}
.servics{
text-align: center;
}

How to Display the button and fontawesome icon in same line

.add-cart-button
{
width:205px;
height:56px;
border-radius: 28px;
background-color: #EC7F4A;
color: #ffff;
font-family: Roboto;
}
.add-cart-button-icon
{
color: #232323;
float: right;
font-size: 40px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<button class="add-cart-button">
<span>Add to Cart</span><i class="fa fa-plus-circle fa-6 add-cart-button-icon" aria-hidden="true"></i>
</button>
I'm using Bootstrap4 doubt in button that i need to display button along with fontawosome icon.can any one please tell me to do it.
Expected image
Actual output i got now
Image of Actual output i got now
You can simply add <i> tag inside button.
EDIT: I've added your code to same snippet. Just adding line-height: 40px; to add-cart-button class provides the alignment fix.
.round-btn {
border-radius: 19px !important;
}
.add-cart-button {
width: 205px;
height: 56px;
border-radius: 28px;
background-color: #EC7F4A;
color: #ffff;
font-family: Roboto;
line-height: 40px;
}
.add-cart-button-icon {
color: #232323;
float: right;
font-size: 40px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<body>
<div class="container">
<button type="button" class="btn btn-warning round-btn">Warning<i class="pl-2 fa fa-plus-circle"></i></button>
<button class="add-cart-button">
<span>Add to Cart</span><i class="fa fa-plus-circle fa-6 add-cart-button-icon" aria-hidden="true"></i>
</button>
</div>
</body>
</html>

How to use glyphicon on top of bootstrap badge in html

I want to show glyphicon on the top of bootstrap badge.
Can anyone share the css for the same.
I need glyphicon to be placed at the top of badge like given below
PS: I need glyph over (on the top corner of the badge)
Here is the code
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<span class="badge">10</span>
<span class="glyphicon glyphicon-time"></span>
</div>
</body>
</html>
You can try below css.
It is working for me
.badge > .glyphicon {
position: absolute;
top: -15px;
background: red;
padding: 5px;
border-radius:50%;
}
.badge {
margin-top: 15px;
position: relative;
}
Try this
.badge {
margin-top: 20px;
position: relative;
}
.badge > .glyphicon {
position: absolute;
top: -10px;
background: red;
padding: 5px;
border-radius:50%;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<span class="badge">10 <span class="glyphicon glyphicon-time"></span></span>
</div>
</body>
</html>
Try this below
.group .glyphicon.glyphicon-time {
left: 33px;
position: absolute;
top: 4px;
}
.group .badge {
margin-top: 10px;
position: relative;
}
.group{ }
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="group">
<span class="badge">10</span>
<span class="glyphicon glyphicon-time"></span>
</div>
</div>
</body>
</html>
you can also try this code and result will look like this
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="badge-container" style="
display: inline-block;
position: relative;
margin: 20px 0;
">
<span class="badge">10</span>
<span class="glyphicon glyphicon-time" style="
position: absolute;
right: -4px;
top: -5px;
"></span>
</div>
</div>
</body></html>
try this:
.glyphicon{
top: 24px !important;
font-size: 31px;
}
.badge {
margin-left: -10px;
background-color: #E91E63 !important;
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
</script>
</head>
<body>
<div class="container">
<span class="glyphicon glyphicon-time"></span>
<span class="badge">10</span>
</div>
</body>
</html>