How do I make text overlap a shape in HTML/CSS? - html

Here, I'm making a food pyramid that has interactive buttons that allow you to add and take away the amount your of food your eating in each section of the pyramid. But, I'm not sure how to make the counter for each sector (the first triangle and then each trapezoid) overlap the circle its meant to be on. For example in the first sector (the triangle) there meant to be a circle in the middle of it that contains the counter on top of it and then a plus sign on the right, and a minus sign on the left.
.triangle {
border-bottom: 150px solid #FF6347;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
height: 0;
width: 0;
margin-left: auto;
margin-right: auto;
white-space: nowrap;
display: block;
}
.trapezoid {
border-bottom: 100px solid #f58c57;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
height: 0;
width: 220px;
margin-left: auto;
margin-right: auto;
padding-bottom: 20px;
}
.trapezoid1 {
border-bottom: 100px solid #fff894;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
height: 0;
width: 360px;
margin-left: auto;
margin-right: auto;
padding-bottom: 20px;
}
.trapezoid2 {
border-bottom: 100px solid #83ccde;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
height: 0;
width: 480px;
margin-left: auto;
margin-right: auto;
}
.trapezoid3 {
border-bottom: 100px solid #a87d5c;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
height: 0;
width: 600px;
margin-left: auto;
margin-right: auto;
}
.trapezoid4 {
border-bottom: 100px solid #9effa6;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
height: 0;
width: 720px;
margin-left: auto;
margin-right: auto;
}
.circle1{
height: 45px;
width: 45px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 100px;
margin-left: -22px;
margin-right: auto;
opacity: 0.7;
}
.circle2{
height: 50px;
width: 50px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 45px;
margin-left: 87px;
margin-right: auto;
opacity: 0.7;
}
.circle3{
height: 50px;
width: 50px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 45px;
margin-left: 158px;
margin-right: auto;
opacity: 0.7;
}
.circle4{
height: 50px;
width: 50px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 25px;
margin-left: 219px;
margin-right: auto;
opacity: 0.7;
}
.circle5{
height: 50px;
width: 50px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 25px;
margin-left: 279px;
margin-right: auto;
opacity: 0.7;
}
.circle6{
height: 50px;
width: 50px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 25px;
margin-left: 339px;
margin-right: auto;
opacity: 0.7;
}
.button1 {
background-color: white;
border: none;
padding: 20px;
height: 5px;
width: 5px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 0px;
top: -18px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button2{
background-color: white;
border: none;
padding: 20px;
height: 5px;
display: none;
width: 5px;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: -147px;
top: -18px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button3 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 3px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button4 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 30px;
top: -73px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button5 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 5px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button6 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: -168px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button7 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 5px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button8 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: -167px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button9 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 6px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button10 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: -168px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button11 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: 6px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.button12 {
background-color: white;
border: none;
padding: 20px;
height: 10px;
width: 10px;
display: none;
margin-left: 0px;
cursor: pointer;
border-radius: 50%;
position: relative;
left: -169px;
top: -23px;
opacity: 0.7;
text-align: center;
text-decoration: none;
line-height: 5px;
}
.piece:hover .button1, .piece:hover .button2, .piece:hover .button3, .piece:hover .button4, .piece:hover .button5, .piece:hover .button6, .piece:hover .button7, .piece:hover .button8, .piece:hover .button9, .piece:hover .button10, .piece:hover .button11, .piece:hover .button12{
display: inline-block;
opacity: 0.7;
}
.text1{
text-align: center;
line-height: 0px;
font-family: "helvetica",serif;
font-size: 20px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="assignment01.css">
</head>
<body>
<h1 style = "font-family: helvetica"><center>Figure 1</center></h1>
<script type="text/javascript">
var clicks = 0;
function onClick() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
}
function onClickm() {
clicks -= 1;
document.getElementById("clicks").innerHTML = clicks;
}
</script>
<p class= "text1" id="clicks">0</p>
<div class="triangle piece">
<div class="circle1 "></div>
<div class="button1 " onClick="onClick()"><span>+</span></div>
<div class="button2" onClick="onClickm()"><span>-</span></div>
</div>
<div class="trapezoid piece">
<div class="circle2 "></div>
<div class="button3"><span>+</span></div>
<div class="button4"><span>-</span></div>
</div>
<div class="trapezoid1 piece">
<div class="circle3 "></div>
<div class="button5"><span>+</span></div>
<div class="button6"><span>-</span></div>
</div>
<div class="trapezoid2 piece">
<div class="circle4 "></div>
<div class="button7"><span>+</span></div>
<div class="button8"><span>-</span></div>
</div>
<div class="trapezoid3 piece">
<div class="circle5 "></div>
<div class="button9"><span>+</span></div>
<div class="button10"><span>-</span></div>
</div>
<div class="trapezoid4 piece">
<div class="circle6 "></div>
<div class="button11"><span>+</span></div>
<div class="button12"><span>-</span></div>
</div>
<h2 style = "font-family: helvetica"><center>My Food Pyramid</center></h2>
<label style = "font-family: helvetica" for="name"><center>Please Enter The Date:</center></label>
<center><input type="text" id="name" name="name" required maxlength="9" size="10"></center>
</body>
</html>

Why not place the counter directly in the circle in the HTML?
<div class="triangle piece">
<div class="circle1 "><p class= "text1" id="clicks">0</p></div>
<div class="button1 " onClick="onClick()"><span>+</span></div>
<div class="button2" onClick="onClickm()"><span>-</span></div>
</div>
Then you can use the .text1 css to position it exactly in the center.
.circle1{
height: 45px;
width: 45px;
background-color: #ffffff;
border-radius: 50%;
display: inline-block;
margin-top: 100px;
margin-left: -22px;
margin-right: auto;
opacity: 0.7;
position: relative;
}
.text1{
text-align: center;
line-height: 0px;
font-family: "helvetica",serif;
font-size: 20px;
position: absolute;
left: 18px;
top: 5px;
}
Because the counter is within the circle and the circle has position:relative the text will be positioned absolute with regards to the circle it's in.

Related

Search input pushes link list when it expands

When I hover over search icon, div with class "forma" expands and pushes the list with links to the left. How can I prevent this? My guess is something to do with position, display or width, but I am not sure. This is probably not a complicated task, but I am not very good with CSS.
Here is HTML:
<nav>
<div class=logo>
<img src="images/logoicon.png" alt="sunce">
<img src="images/logotext.png" alt="outdoors" id="logotext"></a>
</div>
<ul class="nav-ul">
<li>Destinations</li>
<li>Travel style</li>
<li>Trabel deals</li>
<li>Gear</li>
</ul>
<div class="forma">
<input type="search" placeholder="search" class="pretraga">
<i class="fa fa-search"></i>
</div>
</nav>
Here is CSS:
nav {
background-color: steelblue;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
position: sticky;
top: 0;
z-index: 2;
}
.nav-ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
/* background-color: #333; */
}
.nav-ul li {
display: inline;
float: left;
}
.nav-ul li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-ul li:last-child {
float: right;
}
.nav-ul li a:hover:not(.active) {
background-color: #111;
}
.forma {
position: relative;
top: 20px;
left: 20px;
transform: translate(0, -50%);
transition: all 1s;
width: 50px;
height: 50px;
background: white;
box-sizing: border-box;
border-radius: 25px;
border: 4px solid white;
padding: 5px;
}
input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 40px;
line-height: 30px;
outline: 0;
border: 0;
display: none;
font-size: 1em;
border-radius: 20px;
padding: 0 20px;
}
.fa {
box-sizing: border-box;
padding: 10px;
width: 40px;
height: 40px;
position: absolute;
top: 0;
right: 0;
border-radius: 50%;
color: black;
text-align: center;
font-size: 1.2em;
transition: all 1s;
}
.forma:hover {
width: 200px;
cursor: pointer;
}
.forma:hover input {
display: block;
}
Try below CSS here I have changed little bit code
Your Code
.forma {
position: relative;
top: 20px;
left: 20px;
transform: translate(0, -50%);
transition: all 1s;
width: 50px;
height: 50px;
background: white;
box-sizing: border-box;
border-radius: 25px;
border: 4px solid white;
padding: 5px;
}
input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 40px;
line-height: 30px;
outline: 0;
border: 0;
display: none;
font-size: 1em;
border-radius: 20px;
padding: 0 20px;
}
.forma:hover {
width: 200px;
cursor: pointer;
}
.forma:hover input {
display: block;
}
Updated Code
Add this link in your HTML page for icon
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
.forma {
height: 50px;
width: 250px;
position: relative;
top: 20px;
left: 20px;
transform: translate(0, -50%);
}
input {
position: absolute;
right: 21px;
width: 90px;
max-width: 350px;
transition: all 1s;
height: 50px;
background: white;
box-sizing: border-box;
border-radius: 25px;
border: 4px solid white;
padding: 5px;
outline: 0;
}
input:focus{
outline: 0;
}
input:hover{
width: 350px;
}
You can check Live preview
nav {
background-color: steelblue;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
position: sticky;
top: 0;
z-index: 2;
}
.nav-ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
/* background-color: #333; */
}
.nav-ul li {
display: inline;
float: left;
}
.nav-ul li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-ul li:last-child {
float: right;
}
.nav-ul li a:hover:not(.active) {
background-color: #111;
}
.forma {
height: 50px;
width: 250px;
position: relative;
top: 20px;
left: 20px;
transform: translate(0, -50%);
}
input {
position: absolute;
right: 21px;
width: 90px;
max-width: 350px;
transition: all 1s;
height: 50px;
background: white;
box-sizing: border-box;
border-radius: 25px;
border: 4px solid white;
padding: 5px;
outline: 0;
}
.fa {
box-sizing: border-box;
padding: 10px;
width: 40px;
height: 40px;
position: absolute;
top: 5px;
right: 20px;
border-radius: 50%;
color: black;
text-align: center;
font-size: 1.2em;
transition: all 1s;
}
input:focus{
outline: 0;
}
input:hover{
width: 350px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<nav>
<div class=logo>
<img src="images/logoicon.png" alt="sunce">
<img src="images/logotext.png" alt="outdoors" id="logotext">
</div>
<ul class="nav-ul">
<li>Destinations</li>
<li>Travel style</li>
<li>Trabel deals</li>
<li>Gear</li>
</ul>
<div class="forma">
<input type="search" placeholder="search" class="pretraga">
<i class="fa fa-search"></i>
</div>
</nav>
you can check Here
NOTE : Better view on desktop you have to write code for mobile also with #media rule

cannot add my slidemenu to my mainfile css/html

i made a slidermenu, but i failed some stuff. I dont know how to make it sticky. but the biggest problem is that it looks wheird when i add it to my main file. it works fine when i run the slidebar on a clear page but when i implemnt it into this file it looks crazy. the sysmbols r not infront of the text anymore.
can anyone tell me how i can add the slidermenu to this file right
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="../js/jquery-3.5.1.min.js"></script>
<link rel="stylesheet" href="../css/stylesearch.css">
<link rel="icon" href="../images/logo.ico">
<link rel="stylesheet" href="../css/slidebar.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Search</title>
</head>
<body>
<div id="background-box" onclick="tag()"></div>
<div class="container" id="tag-box">
<div><a class="close-box" onclick="tag(), getValue()">×</a></div>
<br>Selectable Tags:</br>
</div>
<nav>
<script src="../js/slidebar.js"></script>
<img class="image-size" src="../images/logo.png">
<div class="bars"><i class="fa fa-bars fa-4x" id="scale" onclick="slidebar()"></i></div>
<a><img class="image-size" src="../images/menu.png" onclick=""></a>
<button id="btnabout" onclick="tag()">Tags</button>
<div class="search_box"><input type="text" name="box" id="search_text" placeholder="Search by name" class="form-control" /></div>
<div id="background-boxtitle" onclick="tag()"></div>
</nav>
<section class="sec1">
<div class="slidebar" id="slidebar"><?php include '../db/slidebar.php'; echo $slidebarbutton;?></div>
</section>
<section class="sec2">
<script src="../js/search.js"></script>
<div id="result"></div>
<div style="clear:both"></div>
</section>
<section class="sec3">
</section>
</body>
</html>
:root {
--slidermenu-color: #303030;
}
#slidebar{
position:absolute;
left:-15%;
width: 15%;
height: 100%;
transition: .5s;
background: var(--slidermenu-color);
overflow: scroll;
overflow-x: hidden;
}
#slidebar.active{
left: 0%;
}
#slidebarlock{
position: absolute;
left: -100%;
width: 85%;
height: 100%;
background: transparent;
transition: .5s;
}
#slidebarlock.active{
left: 15%;
}
.slidebarbutton {
background-color: #303030;
border: none;
color: white;
text-align: left;
text-decoration: none;
display: inline-block;
font-size: 30px;
cursor: pointer;
padding: 20px 0px;
width: 100%;
}
.slidebarbutton:hover{
background-color: #494949;
}
.bars:hover{
cursor: pointer;
}
.slidebarbutton div i{
padding-left:20px;
padding-right: 40px;
}
#slidebar::-webkit-scrollbar {
width: 5px;
}
#slidebar::-webkit-scrollbar-track {
background: var(--slidermenu-color);
}
#slidebar::-webkit-scrollbar-thumb {
background: transparent;
}
#slidebar:hover::-webkit-scrollbar-thumb{
background: black;
opacity: .8;
border-radius: 30px;
}
body{
margin: 0;
padding: 0;
font-family: sans-serif;
background: #222;;
}
header{
padding: 10px 100px;
box-sizing: border-box;
}
section{
width: 100%;
height: 100vh;
}
section.sec1{
width: 100%;
height: 50px;
}
div.gallery:hover {
border: 2px solid #404040;
background: #404040;
}
div.gallery {
margin: 5px;
border: 2px solid #222;
float: left;
width: 215px;
height: 400px;
color: #fff;
}
div.gallery img {
width: 100%;
height: 80%;
}
div.desc {
padding: 15px;
text-align: center;
}
section.sec3{
padding: 100px;
box-sizing: border-box;
height: auto;
}
section.sec3 h2{
font-size: 3em;
margin:0;
padding: 0;
color: #fff;
}
nav{
width: 100%;
height: 120px;
background: url(../images/bg1.jpg);
position: sticky;
top: 0px;
}
nav ul{
display: flex;
}
.image-size{
position: absolute;
top: 10%;
right: 1%;
height: 40px;
}
.search_box{
position: absolute;
top: 20%;
left: 50%;
transform: translate(-150%, -50%);
height: 20px;
}
.search_box input[type="text"]{
width: 300%;
padding: 20px;
padding-right: 60px;
box-sizing: border-box;
background: rgba(0,0,0,0.3);
border: 2px solid #fff;
border-radius: 10px;
font-size: 18px;
color: #fff;
outline: none;
}
.fa-search{
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 25px;
color: #fff;
font-size: 25px;
}
::-webkit-input-placeholder {
color: #fff;
}
::-moz-placeholder {
color: #fff;
}
:-ms-input-placeholder {
color: #fff;
}
#media screen and (max-width: 425px){
.search_box{
width: 95%;
}
}
#tag-box{
position: absolute;
top: -120%;
left: 20%;
width: 60%;
height: 500px;
background: #000;
transition: .5s;
opacity: 0.9;
border-radius: 30px;
}
#tag-box.active{
top: 25%;
}
.container{
max-width: 60%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
.container div{
margin: 5px;
}
.container div a{
font-size: 2em;
margin:0;
padding: 0;
color: #fff;
cursor: pointer;
}
.container div a:hover{
color: #f00;
}
.container div label{
cursor: pointer;
}
.container div label input[type="checkbox"]{
display: none;
}
.container div label span{
position: relative;
display: inline-block;
background: #424242;
color: #fff;
padding: 5px 10px;
color: 555;
text-shadow: 0 1px 4px rgba(0,0,0,.5);
border-radius: 15px;
font-size: 12px;
transition: 0.5s;
user-select: none;
overflow: hidden;
border: 2px solid #FFA500;
}
.container div label span:before{
content: '';
position: absolute;
top: absolute;
top: 0;
left: 0;
width: 100%;
height: 50%
}
.container div label input[type="checkbox"]:checked ~ span{
background: #FFA500;
color: #fff;
border: 2px solid #FFA500;
box-shadow: 0 2px 15px #FFA500;
}
#background-box {
position: absolute;
top: -120%;
left: 0%;
width: 100%;
height: 100%;
background: #000;
opacity: 0;
}
#background-box.active{
top: 0%;
}
#background-boxtitle {
position: absolute;
top: -120%;
left: 0%;
width: 100%;
height: 100%;
background: #000;
opacity: 0;
}
#background-boxtitle.active{
top: 0%;
}
#scale{
transition: .5s;
color:white;
transform: translate(22px, 16px);
}
#scale.active{
transition: .5s;
transform: translate(22px, 16px) rotate(90deg);
}

Different renditions on firefox and chrome of search bar

Hi I have created the following search bar:
<div class="container-fluid">
<div class="search-bar">
<form class="searchBar">
<div class="row" >
<div class="allElements">
<div class="input-group" >
<span style="color:black" class="input-group-addon">
<select id="selection" onchange="getValues(this.value)">
<option>Choose Category</option>
<option>All</option>
<option>Notary</option>
<option>Deed Date</option>
<option>Person</option>
<option>Place</option>
<option>Register Reference</option>
<option>Subject</option>
</select>
</span>
<div class="autocomplete" style ="width:400px">
<input id="search" type="text" class="form-control" name="search" placeholder="Choose a category" style ="width:400px" disabled=true>
</div>
<span class="input-group-addon" style="color:black"> <button type="button" onclick="doSparql(this.value)">Search</button></span>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
Where on firefox is rendered perfectly while on the chrome, the search button is on the other side of the screen not grouped with the rest of the search bar as shown in the picture below. Any idea why this is happening and how I can solve it pls?
The css is:
-moz-webkit-margin:0px
html, body {
max-width: 100%;
overflow-x: hidden;
}
.footer-div {
display: inline;
height: 100%;
}
.panel-footer
{
position: fixed;
bottom: 0;
width: 100%;
padding: 0px 0px;
background-color: rgba(70,131,172,1);
height: 10%;
max-height: 50px;
border-color: #fff;
border-top: 0px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
z-index: 100;
}
.container-midvalign
{
height:100%;
padding: 0 0;
vertical-align: middle;
display: inline-table;
text-align: left;
}
.contents-midvalign
{
font-weight: bold;
color: #FFFFFF;
font-size: 14px;
vertical-align:middle;
display: table-cell;
text-align: left;
position: relative
}
.contents-midvalign:hover
{
color: #fff;
text-decoration: underline;
}
.footer-img {
background: url(../media/icons/MALTA_COAT_OF_ARMS_WHITE.png) no-repeat;
height: 100%;
max-height: 50px;
background-size: contain;
position: relative;
padding: 0px 0px;
margin-left: 25px;
margin-right: 10px;
margin-top: 0px;
margin-bottom: 0px;
vertical-align: middle;
background-color: transparent;
border: 0px solid transparent;
border-radius: 0px;
}
.footer-div
{
display: inline;
height: 100%;
}
.footer-icon
{
font-size: 24px;
padding-right: 25px;
}
.footer-icon:hover
{
text-decoration: none;
}
.bg-gemma
{
background-color: rgba(70,131,172,1) !important;
}
.bg-transparent
{
background-color: transparent !important;
border-color: transparent !important;
box-shadow: 0 0 0 0 rgba(108,117,125,0) !important;
}
.navbar
{
/* height: 10%;*/
min-height: 50px;
/* overflow: hidden;*/
margin: 0 auto;
padding: 0px;
position: fixed;
border: 0px solid transparent;
width: 100%;
background-color: rgba(70,131,172,1);
}
.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}
h2{
font-weight: bold;
color: black;
font-size: 40px;
position: relative;
}
#headerdiv {
margin-top: 10px;
margin-bottom: 10px;
}
#fullpagecont
{
padding-left: 25px;
padding-right: 25px;
}
#pheader
{
text-align: center;
}
html body .container-fluid.body-content {
position: absolute;
top: 50px;
bottom: 50px;
right: 0;
left: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
select {
background: transparent;
border: none;
padding: 6px 12px;
}
.input-group-addon {
padding: 0!important;
}
#results{
margin-left: 120px;
margin-right: 120px;
position: relative;
}
.add_data{
margin-left: 150px;
width:20%;
margin-top:5px;
text-align:center;
}
.search-bar{
position: absolute;
left: 35%;
top:130px;
}
.autocomplete {
/*the container must be positioned relative:*/
position: relative;
}
.autocomplete-items {
position: absolute;
text-align: left;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
/*position the autocomplete items to be the same width as the container:*/
top: 100%;
left: 0;
right: 0;
}
button {
padding: 6px 12px;
background: transparent;
border: none;
}
.autocomplete-items div {
padding:10px;
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div:hover {
/*when hovering an item:*/
background-color: #e9e9e9;
}
.autocomplete-active {
/*when navigating through the items using the arrow keys:*/
background-color: DodgerBlue !important;
color: #ffffff;
}
#div_pagination{
width:100%;
margin-top:5px;
text-align:center;
}
#div_pagination_all{
width:100%;
margin-top:5px;
text-align:center;
}
#pageNo{
text-align:center;
margin-top: 20px;
}
#main-container{
margin-top: 200px;
width:90%;
margin-left: 75px;
}
#details{
margin-top: 25px;
margin-left: 25px;
}
.deedList{
margin-left: 15px;
}
#media (max-width: 575px)
{
.footer-icon
{
padding-right: 10px;
}
.footer-img
{
margin-left: 10px;
}
}
I saw this in chrome:
and this in FF:
To get on the line I added this:
.autocomplete {
position: relative;
display: inline-block;
}

How do I get this button layout?

I'm trying to get this layout.
<blockquote class="imgur-embed-pub" lang="en" data-id="a/kCjW9"></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
Here's the code I have. I can't seem to get z-index to work so that I could bring black border on top of the background.
<blockquote class="imgur-embed-pub" lang="en" data-id="a/6a7Ev"></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
.btn {
border-radius: 0px!important;
font-family: $font-roboto!important;
font-size: 1.125rem!important;
text-shadow: none!important;
box-shadow: none!important;
&.fountain-blue {
background-color: $color-fountain-blue;
color: #fff;
margin-left:5px;
margin-top: 5px;
margin-right: -10px;
}
}
.btn-border {
border: 2px solid #000;
display: inline-block;
height: 40px;
z-index: 9999!important;
}
<div class="btn-border mt-4">
learn more about us
</div>
There are a lot of ways to do this but simple method is to use pseudo-elements. check out the snippet.
CODEPEN (SASS version)
#import url("https://fonts.googleapis.com/css?family=Roboto");
.btn {
border-radius: 0px;
font-size: 1.125rem;
text-shadow: none;
box-shadow: none;
display: block;
width: calc(100% - 25px);
text-decoration: none;
font-family: 'Roboto', sans-serif;
text-align: center;
}
.btn.fountain-blue {
background-color: #65becf;
color: #fff;
margin-left: 5px;
margin-top: 5px;
padding-top: 10px;
padding-bottom: 15px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
.btn-border {
display: inline-block;
height: 40px;
z-index: 9999;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.btn-border:after {
content: '';
border: 2px solid #000;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
<div class="btn-border mt-4">
READ MORE
</div>
You should do it something like this, but than with your own colors and sizes.
.btn {
display: inline-block;
border: 1px solid black;
position: relative;
padding: 10px 20px;
margin: 20px;
color: #fff;
}
.btn:before {
background-color: blue;
border-color: green;
border-style: solid;
border-width: 10px 5px 5px 10px;
z-index: -1;
position: absolute;
height: 100%;
width: 100%;
top: -5px;
left: -5px;
content: "";
}
<a class="btn">Read more</a>
As a possible solution.
* {
box-sizing: border-box;
}
body {
margin: 2em;
}
.btn {
background-color: darkblue;
color: white;
border: .2em solid white;
height: 2.5em;
width: 7em;
position: relative;
cursor: pointer;
}
.btn:before {
content: " ";
width: 9em;
height: 4em;
background-color: lightblue;
position: absolute;
top: -1em;
left: -1em;
z-index: -1;
}
.btn:after {
content: " ";
position: absolute;
background-color: transparent;
border: thin solid black;
height: 2em;
width: 6.5em;
top: -.5em;
left: -.5em;
}
<button class="btn">Click me</button>

Replicating nutrition label - expert CSS level

I am trying to emulate this nutrition label format in CSS, but I can't get the shapes right at all. The best I can come up with is fiddling with border-radius, but that gives me more of a pill shape, and still not way to get the black cut-out shape at the bottom. Has anyone replicated such a nutrition label in CSS? Would anyone be willing to try? Any help would be greatly appreciated.
Here is a link to what I have so far: jsfiddle.net/f5jczunf/
#block {
border-radius:50%/10px;
background: #ccc;
padding: 20px;
width: 50px;
height: 100px;
border: 1px solid #000;
background-color:#FFF;
text-align:center;
}
.number {
font-weight:bold;
font-size:18pt;
text-align:center;
}
<div id="block">
<span class="number">150</span>
<br/>Calories
</div>
Maybe this small example can help.
.label {
position: relative;
width: 100px;
height: 140px;
text-align: center;
border: 1px solid #000;
border-radius: 100px/50px;
overflow: hidden;
}
.title {
display: inline-block;
margin-top: 30px;
}
.bottom {
position: absolute;
bottom: -10px;
left: 0;
right: 0;
height: 50px;
color: #fff;
line-height: 40px;
border-top: 1px solid #000;
border-radius: 100px/50px;
background-color: #000;
}
<div class="label">
<span class="title">Title</span>
<span class="bottom">Bottom</span>
</div>
https://jsfiddle.net/9xs2wcbL/1/
Here's my take on it. It does require some advanced, bleeding edge CSS, however.
#import url('https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300');
body {
padding: 3em;
font-size: 16px;
font-family: 'Open Sans Condensed', sans-serif;
}
.label-list {
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
}
.label-list .label-item {
text-align: center;
border: 1px solid;
position: relative;
border-radius: 2em / 0.65em;
padding: 0.2em 0.25em 1.5em;
min-width: 3.5em;
overflow: hidden;
margin: 0.1em;
z-index: 1;
background: white;
color: black;
}
.label-list .label-item h1 {
font-size: 3em;
line-height: 1em;
font-weight: 900;
margin: 0;
}
.label-list .label-item h1.smaller {
font-size: 1.75em;
margin-top: 0.5em;
}
.label-list .label-item h1 small {
font-size: 0.4em;
text-transform: none;
}
.label-list .label-item small {
font-size: 1em;
line-height: 1em;
font-weight: 900;
text-transform: uppercase;
}
.label-list .label-item span {
position: absolute;
bottom: 0.5em;
left: 0;
right: 0;
color: white;
font-size: 0.8em;
line-height: 1em;
}
.label-list .label-item span:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
top: 0;
background: black;
z-index: -1;
border-radius: 40%;
transform-origin: center;
width: 100%;
height: 0;
padding-top: 100%;
margin: auto;
transform: rotate(45deg) translate(20%, 20%);
}
<div class="label-list">
<div class="label-item">
<h1>140</h1>
<small>Calories</small>
</div>
<div class="label-item">
<h1 class="smaller">1<small>g</small></h1>
<small>Sat Fat</small>
<span>5% DV</span>
</div>
</div>
I believe the only way to have this sort of shape in pure CSS is with a few overlapping shapes, something similar to the code below:
.wrapper {
position: relative;
height: 112px;
width: 80px;
overflow: hidden;
}
.rectangle,
.circle {
position: absolute;
box-sizing: border-box;
}
.rectangle {
height: 96px;
width: 80px;
top: 8px;
border-left: 1px solid black;
border-right: 1px solid black;
}
.circle {
width: 200px;
height: 200px;
left: -60px;
border-radius: 200px;
border: 1px solid black;
}
.top {
top: 0;
}
.bottom {
bottom: 0;
}
<div class="wrapper">
<div class="circle top"></div>
<div class="rectangle"></div>
<div class="circle bottom"></div>
</div>
https://jsfiddle.net/dylanstark/01hck5dv/
here my approach for that. I'm using before and after pseudo-elements.
before contains black bg with border-radius and it is overflowing the main #block which has overflow: hidden;.
aftercontains text that is coming from data-text attribute of #block
#block {
border-radius: 50%/10px;
background: #ccc;
padding: 20px;
width: 50px;
height: 100px;
border: 1px solid #000;
background-color: #FFF;
text-align: center;
position: relative;
overflow: hidden;
}
#block:before {
display: block;
content: " ";
position: absolute;
bottom: -15px;
left: 0;
width: 100%;
height: 50px;
border-radius: 50%;
background: black;
z-index: 0;
}
#block:after {
display: block;
content: attr(data-label);
position: absolute;
bottom: 5px;
color: white;
text-align: center;
z-index: 1;
}
.number {
font-weight: bold;
font-size: 18pt;
text-align: center;
}
<div id="block" data-label="5% DY">
<span class="number">150</span>
<br/>Calories
</div>