I'm making a calculator app and having a bit weird styling problem. Can someone explain me why the digits inside buttons are not centered vertically? If you look closer it looks like they are a little bit above center position. I think its because of font-family placed in "*" selector.
But why is that not centered even if the font is different? Even vertical-align: middle does not help.
buttons
let input1 = document.getElementById("input1");
let input2 = document.getElementById("input2");
let input3 = document.getElementById("input3");
let main = document.getElementById("main");
input1.checked = true;
function setColorTheme() {
if (input1.checked == true) {
main.classList.add("dark");
} else {
main.classList.remove("dark");
}
if (input2.checked == true) {
main.classList.add("light");
} else {
main.classList.remove("light");
}
if (input3.checked == true) {
main.classList.add("saturated");
} else {
main.classList.remove("saturated");
}
}
setColorTheme();
document.querySelectorAll('input[name="theme"]').forEach((e) => {
e.addEventListener("change", setColorTheme);
});
.dark {
--mainBackground: hsl(222, 26%, 31%);
--keypad_toggle_Background: hsl(223, 31%, 20%);
--screenBackground: hsl(224, 36%, 15%);
--removeKeyBackground: hsl(225, 21%, 49%);
--removeKeyShadow: hsl(224, 28%, 35%);
--equal_toggle_KeyBackground: hsl(6, 63%, 50%);
--equalKeyShadow: hsl(6, 70%, 34%);
--normalKeyBackground: hsl(30, 25%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(221, 14%, 31%);
--default: hsl(0, 0%, 100%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.light {
--mainBackground: hsl(0, 0%, 90%);
--keypad_toggle_Background: hsl(0, 5%, 81%);
--screenBackground: hsl(0, 0%, 93%);
--removeKeyBackground: hsl(185, 42%, 37%);
--removeKeyShadow: hsl(185, 58%, 25%);
--equal_toggle_KeyBackground: hsl(25, 98%, 40%);
--equalKeyShadow: hsl(25, 99%, 27%);
--normalKeyBackground: hsl(45, 7%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(60, 10%, 19%);
--default: hsl(0, 0%, 0%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.saturated {
--mainBackground: hsl(268, 75%, 9%);
--keypad_toggle_Background: hsl(268, 71%, 12%);
--screenBackground: hsl(268, 71%, 12%);
--removeKeyBackground: hsl(281, 89%, 26%);
--removeKeyShadow: hsl(285, 91%, 52%);
--equal_toggle_KeyBackground: hsl(176, 100%, 44%);
--equalKeyShadow: hsl(177, 92%, 70%);
--normalKeyBackground: hsl(268, 47%, 21%);
--normalKeyShadow: hsl(290, 70%, 36%);
--normalKeyText: hsl(52, 100%, 62%);
--default: hsl(52, 100%, 62%);
--equalColorText: hsl(198, 20%, 13%);
--delResetColorText: hsl(0, 0%, 100%);
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Spartan", sans-serif;
}
main {
background: var(--mainBackground);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: var(--default);
}
.calc-container {
min-height: 55vh;
width: 28%;
}
.calc-container header {
display: flex;
min-height: 10vh;
width: 90%;
margin: auto;
align-items: center;
justify-content: space-between;
}
.calc-container header .theme-toggler {
display: flex;
margin-bottom: 0.8rem;
}
.calc-container header .theme-toggler h2 {
font-size: 12px;
align-self: flex-end;
margin-right: 1rem;
}
.calc-container header .theme-toggler .label-container {
display: flex;
justify-content: space-evenly;
text-align: center;
}
.calc-container header .theme-toggler .label-container .label {
margin: 0rem 0.35rem;
}
.calc-container header .theme-toggler .input-container {
width: 60px;
height: 20px;
border-radius: 10px;
background: var(--keypad_toggle_Background);
display: flex;
align-items: center;
justify-content: space-evenly;
}
.calc-container header .theme-toggler .input-container .input {
appearance: none;
background: var(--equal_toggle_KeyBackground);
width: 15px;
height: 15px;
border-radius: 50%;
opacity: 0;
cursor: pointer;
}
.calc-container header .theme-toggler .input-container .input:checked {
opacity: 1;
}
.calc-container .screen {
min-height: 10vh;
width: 90%;
background: var(--screenBackground);
margin: auto;
border-radius: 10px;
display: flex;
align-items: flex-end;
justify-content: center;
flex-direction: column;
word-wrap: break-word;
word-break: break-all;
}
.calc-container .screen-one,
.calc-container .screen-two {
margin: 0.2rem 1.8rem;
width: auto;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.calc-container .screen-one {
font-size: 15px;
opacity: 0.5;
}
.calc-container .screen-two {
font-size: 1.4rem;
}
.calc-container .button-container {
min-height: 40vh;
width: 90%;
background: var(--keypad_toggle_Background);
border-radius: 10px;
margin: 1rem auto;
display: grid;
grid-template-columns: repeat(4, 1fr);
padding: 1.5rem;
grid-gap: 1rem;
text-align: center;
}
.calc-container .button-container .button,
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete,
.calc-container .button-container .operation {
border-radius: 10px;
outline: none;
border: none;
font-size: 1.4rem;
cursor: pointer;
background: var(--normalKeyBackground);
box-shadow: 0 5px var(--normalKeyShadow);
}
.calc-container .button-container .reset,
.calc-container .button-container .delete {
background: var(--removeKeyBackground);
color: var(--delResetColorText) !important;
box-shadow: 0 5px var(--removeKeyShadow);
}
.calc-container .button-container .reset:hover,
.calc-container .button-container .delete:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .equal {
background: var(--equal_toggle_KeyBackground);
box-shadow: 0 5px var(--equalKeyShadow);
color: var(--equalColorText) !important;
}
.calc-container .button-container .equal:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete {
color: var(--default);
}
.calc-container .button-container .button,
.calc-container .button-container .operation {
color: var(--normalKeyText);
}
.calc-container .button-container .button:hover,
.calc-container .button-container .operation:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset {
grid-column: 1/3;
}
.calc-container .button-container .equal {
grid-column: 3/5;
}
p {
position: absolute;
left: 50%;
bottom: 1%;
color: white;
font-size: 12px;
transform: translate(-50%, 0);
}
p span {
text-decoration: underline;
}
#media screen and (max-width: 1100px) {
.calc-container {
transform: translate(-50%, 0);
}
.button-container {
width: 300px !important;
}
.screen {
width: 300px !important;
}
header {
width: 300px !important;
}
p {
text-align: center;
width: 80%;
}
}
#media screen and (max-width: 375px) {
.calc-container {
transform: translate(-90%, -15%) !important;
}
input {
-webkit-appearance: none;
background: var(--equal_toggle_KeyBackground);
}
p {
text-align: center;
width: 60%;
}
header {
width: 300px !important;
}
}
/*# sourceMappingURL=style.css.map */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./images/favicon-32x32.png"
/>
<link rel="stylesheet" href="./css/style.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Spartan:wght#700&display=swap"
rel="stylesheet"
/>
<script src="./script.js" defer></script>
<title>Frontend Mentor | Calculator app</title>
</head>
<body>
<main id="main">
<div class="calc-container">
<header>
<h1>calc</h1>
<div class="theme-toggler">
<h2>THEME</h2>
<div>
<div class="label-container">
<label for="input1" class="label">1</label>
<label for="input2" class="label">2</label>
<label for="input3" class="label">3</label>
</div>
<div class="input-container">
<input id="input1" class="input" type="radio" name="theme" />
<input id="input2" class="input" type="radio" name="theme" />
<input id="input3" class="input" type="radio" name="theme" />
</div>
</div>
</div>
</header>
<div class="screen">
<div class="screen-one"></div>
<div class="screen-two"></div>
</div>
<div class="button-container">
<button class="button">7</button>
<button class="button">8</button>
<button class="button">9</button>
<button class="delete">DEL</button>
<button class="button">4</button>
<button class="button">5</button>
<button class="button">6</button>
<button class="operation">+</button>
<button class="button">1</button>
<button class="button">2</button>
<button class="button">3</button>
<button class="operation">-</button>
<button class="button">.</button>
<button class="button">0</button>
<button class="operation">/</button>
<button class="operation">x</button>
<button class="reset">RESET</button>
<button class="equal">=</button>
</div>
</div>
</main>
<p>
Challenge by <span>Frontend Mentor</span>. Coded by
<span>Adrian397</span>.
</p>
</body>
</html>
The usual issue is line-height. Since no numbers have descenders that's not apparent. I'd probably just add a span to contain the text and translate them down.
let input1 = document.getElementById("input1");
let input2 = document.getElementById("input2");
let input3 = document.getElementById("input3");
let main = document.getElementById("main");
input1.checked = true;
function setColorTheme() {
if (input1.checked == true) {
main.classList.add("dark");
} else {
main.classList.remove("dark");
}
if (input2.checked == true) {
main.classList.add("light");
} else {
main.classList.remove("light");
}
if (input3.checked == true) {
main.classList.add("saturated");
} else {
main.classList.remove("saturated");
}
}
setColorTheme();
document.querySelectorAll('input[name="theme"]').forEach((e) => {
e.addEventListener("change", setColorTheme);
});
button>span {
transform: translateY(3px);
display: inline-block;
}
.dark {
--mainBackground: hsl(222, 26%, 31%);
--keypad_toggle_Background: hsl(223, 31%, 20%);
--screenBackground: hsl(224, 36%, 15%);
--removeKeyBackground: hsl(225, 21%, 49%);
--removeKeyShadow: hsl(224, 28%, 35%);
--equal_toggle_KeyBackground: hsl(6, 63%, 50%);
--equalKeyShadow: hsl(6, 70%, 34%);
--normalKeyBackground: hsl(30, 25%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(221, 14%, 31%);
--default: hsl(0, 0%, 100%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.light {
--mainBackground: hsl(0, 0%, 90%);
--keypad_toggle_Background: hsl(0, 5%, 81%);
--screenBackground: hsl(0, 0%, 93%);
--removeKeyBackground: hsl(185, 42%, 37%);
--removeKeyShadow: hsl(185, 58%, 25%);
--equal_toggle_KeyBackground: hsl(25, 98%, 40%);
--equalKeyShadow: hsl(25, 99%, 27%);
--normalKeyBackground: hsl(45, 7%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(60, 10%, 19%);
--default: hsl(0, 0%, 0%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.saturated {
--mainBackground: hsl(268, 75%, 9%);
--keypad_toggle_Background: hsl(268, 71%, 12%);
--screenBackground: hsl(268, 71%, 12%);
--removeKeyBackground: hsl(281, 89%, 26%);
--removeKeyShadow: hsl(285, 91%, 52%);
--equal_toggle_KeyBackground: hsl(176, 100%, 44%);
--equalKeyShadow: hsl(177, 92%, 70%);
--normalKeyBackground: hsl(268, 47%, 21%);
--normalKeyShadow: hsl(290, 70%, 36%);
--normalKeyText: hsl(52, 100%, 62%);
--default: hsl(52, 100%, 62%);
--equalColorText: hsl(198, 20%, 13%);
--delResetColorText: hsl(0, 0%, 100%);
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Spartan", sans-serif;
}
main {
background: var(--mainBackground);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: var(--default);
}
.calc-container {
min-height: 55vh;
width: 28%;
}
.calc-container header {
display: flex;
min-height: 10vh;
width: 90%;
margin: auto;
align-items: center;
justify-content: space-between;
}
.calc-container header .theme-toggler {
display: flex;
margin-bottom: 0.8rem;
}
.calc-container header .theme-toggler h2 {
font-size: 12px;
align-self: flex-end;
margin-right: 1rem;
}
.calc-container header .theme-toggler .label-container {
display: flex;
justify-content: space-evenly;
text-align: center;
}
.calc-container header .theme-toggler .label-container .label {
margin: 0rem 0.35rem;
}
.calc-container header .theme-toggler .input-container {
width: 60px;
height: 20px;
border-radius: 10px;
background: var(--keypad_toggle_Background);
display: flex;
align-items: center;
justify-content: space-evenly;
}
.calc-container header .theme-toggler .input-container .input {
appearance: none;
background: var(--equal_toggle_KeyBackground);
width: 15px;
height: 15px;
border-radius: 50%;
opacity: 0;
cursor: pointer;
}
.calc-container header .theme-toggler .input-container .input:checked {
opacity: 1;
}
.calc-container .screen {
min-height: 10vh;
width: 90%;
background: var(--screenBackground);
margin: auto;
border-radius: 10px;
display: flex;
align-items: flex-end;
justify-content: center;
flex-direction: column;
word-wrap: break-word;
word-break: break-all;
}
.calc-container .screen-one,
.calc-container .screen-two {
margin: 0.2rem 1.8rem;
width: auto;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.calc-container .screen-one {
font-size: 15px;
opacity: 0.5;
}
.calc-container .screen-two {
font-size: 1.4rem;
}
.calc-container .button-container {
min-height: 40vh;
width: 90%;
background: var(--keypad_toggle_Background);
border-radius: 10px;
margin: 1rem auto;
display: grid;
grid-template-columns: repeat(4, 1fr);
padding: 1.5rem;
grid-gap: 1rem;
text-align: center;
}
.calc-container .button-container .button,
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete,
.calc-container .button-container .operation {
border-radius: 10px;
outline: none;
border: none;
font-size: 1.4rem;
cursor: pointer;
background: var(--normalKeyBackground);
box-shadow: 0 5px var(--normalKeyShadow);
}
.calc-container .button-container .reset,
.calc-container .button-container .delete {
background: var(--removeKeyBackground);
color: var(--delResetColorText) !important;
box-shadow: 0 5px var(--removeKeyShadow);
}
.calc-container .button-container .reset:hover,
.calc-container .button-container .delete:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .equal {
background: var(--equal_toggle_KeyBackground);
box-shadow: 0 5px var(--equalKeyShadow);
color: var(--equalColorText) !important;
}
.calc-container .button-container .equal:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete {
color: var(--default);
}
.calc-container .button-container .button,
.calc-container .button-container .operation {
color: var(--normalKeyText);
}
.calc-container .button-container .button:hover,
.calc-container .button-container .operation:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset {
grid-column: 1/3;
}
.calc-container .button-container .equal {
grid-column: 3/5;
}
p {
position: absolute;
left: 50%;
bottom: 1%;
color: white;
font-size: 12px;
transform: translate(-50%, 0);
}
p span {
text-decoration: underline;
}
#media screen and (max-width: 1100px) {
.calc-container {
transform: translate(-50%, 0);
}
.button-container {
width: 300px !important;
}
.screen {
width: 300px !important;
}
header {
width: 300px !important;
}
p {
text-align: center;
width: 80%;
}
}
#media screen and (max-width: 375px) {
.calc-container {
transform: translate(-90%, -15%) !important;
}
input {
-webkit-appearance: none;
background: var(--equal_toggle_KeyBackground);
}
p {
text-align: center;
width: 60%;
}
header {
width: 300px !important;
}
}
/*# sourceMappingURL=style.css.map */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png" />
<link rel="stylesheet" href="./css/style.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Spartan:wght#700&display=swap" rel="stylesheet" />
<script src="./script.js" defer></script>
<title>Frontend Mentor | Calculator app</title>
</head>
<body>
<main id="main">
<div class="calc-container">
<header>
<h1>calc</h1>
<div class="theme-toggler">
<h2>THEME</h2>
<div>
<div class="label-container">
<label for="input1" class="label">1</label>
<label for="input2" class="label">2</label>
<label for="input3" class="label">3</label>
</div>
<div class="input-container">
<input id="input1" class="input" type="radio" name="theme" />
<input id="input2" class="input" type="radio" name="theme" />
<input id="input3" class="input" type="radio" name="theme" />
</div>
</div>
</div>
</header>
<div class="screen">
<div class="screen-one"></div>
<div class="screen-two"></div>
</div>
<div class="button-container">
<button class="button"><span>7</span></button>
<button class="button"><span>8</span></button>
<button class="button"><span>9</span></button>
<button class="delete"><span>DEL</span></button>
<button class="button"><span>4</span></button>
<button class="button"><span>5</span></button>
<button class="button"><span>6</span></button>
<button class="operation"><span>+</span></button>
<button class="button"><span>1</span></button>
<button class="button"><span>2</span></button>
<button class="button"><span>3</span></button>
<button class="operation"><span>-</span></button>
<button class="button"><span>.</span></button>
<button class="button"><span>0</span></button>
<button class="operation"><span>/</span></button>
<button class="operation"><span>x</span></button>
<button class="reset"><span>RESET</span></button>
<button class="equal"><span>=</span></button>
</div>
</div>
</main>
<p>
Challenge by <span>Frontend Mentor</span>. Coded by
<span>Adrian397</span>.
</p>
</body>
</html>
A simple solution is to use padding-top: Check this out.
let input1 = document.getElementById("input1");
let input2 = document.getElementById("input2");
let input3 = document.getElementById("input3");
let main = document.getElementById("main");
input1.checked = true;
function setColorTheme() {
if (input1.checked == true) {
main.classList.add("dark");
} else {
main.classList.remove("dark");
}
if (input2.checked == true) {
main.classList.add("light");
} else {
main.classList.remove("light");
}
if (input3.checked == true) {
main.classList.add("saturated");
} else {
main.classList.remove("saturated");
}
}
setColorTheme();
document.querySelectorAll('input[name="theme"]').forEach((e) => {
e.addEventListener("change", setColorTheme);
});
.dark {
--mainBackground: hsl(222, 26%, 31%);
--keypad_toggle_Background: hsl(223, 31%, 20%);
--screenBackground: hsl(224, 36%, 15%);
--removeKeyBackground: hsl(225, 21%, 49%);
--removeKeyShadow: hsl(224, 28%, 35%);
--equal_toggle_KeyBackground: hsl(6, 63%, 50%);
--equalKeyShadow: hsl(6, 70%, 34%);
--normalKeyBackground: hsl(30, 25%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(221, 14%, 31%);
--default: hsl(0, 0%, 100%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.light {
--mainBackground: hsl(0, 0%, 90%);
--keypad_toggle_Background: hsl(0, 5%, 81%);
--screenBackground: hsl(0, 0%, 93%);
--removeKeyBackground: hsl(185, 42%, 37%);
--removeKeyShadow: hsl(185, 58%, 25%);
--equal_toggle_KeyBackground: hsl(25, 98%, 40%);
--equalKeyShadow: hsl(25, 99%, 27%);
--normalKeyBackground: hsl(45, 7%, 89%);
--normalKeyShadow: hsl(28, 16%, 65%);
--normalKeyText: hsl(60, 10%, 19%);
--default: hsl(0, 0%, 0%);
--equalColorText: hsl(0, 0%, 100%);
--delResetColorText: hsl(0, 0%, 100%);
}
.saturated {
--mainBackground: hsl(268, 75%, 9%);
--keypad_toggle_Background: hsl(268, 71%, 12%);
--screenBackground: hsl(268, 71%, 12%);
--removeKeyBackground: hsl(281, 89%, 26%);
--removeKeyShadow: hsl(285, 91%, 52%);
--equal_toggle_KeyBackground: hsl(176, 100%, 44%);
--equalKeyShadow: hsl(177, 92%, 70%);
--normalKeyBackground: hsl(268, 47%, 21%);
--normalKeyShadow: hsl(290, 70%, 36%);
--normalKeyText: hsl(52, 100%, 62%);
--default: hsl(52, 100%, 62%);
--equalColorText: hsl(198, 20%, 13%);
--delResetColorText: hsl(0, 0%, 100%);
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Spartan", sans-serif;
}
main {
background: var(--mainBackground);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: var(--default);
}
.calc-container {
min-height: 55vh;
width: 28%;
}
.calc-container header {
display: flex;
min-height: 10vh;
width: 90%;
margin: auto;
align-items: center;
justify-content: space-between;
}
.calc-container header .theme-toggler {
display: flex;
margin-bottom: 0.8rem;
}
.calc-container header .theme-toggler h2 {
font-size: 12px;
align-self: flex-end;
margin-right: 1rem;
}
.calc-container header .theme-toggler .label-container {
display: flex;
justify-content: space-evenly;
text-align: center;
}
.calc-container header .theme-toggler .label-container .label {
margin: 0rem 0.35rem;
}
.calc-container header .theme-toggler .input-container {
width: 60px;
height: 20px;
border-radius: 10px;
background: var(--keypad_toggle_Background);
display: flex;
align-items: center;
justify-content: space-evenly;
}
.calc-container header .theme-toggler .input-container .input {
appearance: none;
background: var(--equal_toggle_KeyBackground);
width: 15px;
height: 15px;
border-radius: 50%;
opacity: 0;
cursor: pointer;
}
.calc-container header .theme-toggler .input-container .input:checked {
opacity: 1;
}
.calc-container .screen {
min-height: 10vh;
width: 90%;
background: var(--screenBackground);
margin: auto;
border-radius: 10px;
display: flex;
align-items: flex-end;
justify-content: center;
flex-direction: column;
word-wrap: break-word;
word-break: break-all;
}
.calc-container .screen-one,
.calc-container .screen-two {
margin: 0.2rem 1.8rem;
width: auto;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.calc-container .screen-one {
font-size: 15px;
opacity: 0.5;
}
.calc-container .screen-two {
font-size: 1.4rem;
}
.calc-container .button-container {
min-height: 40vh;
width: 90%;
background: var(--keypad_toggle_Background);
border-radius: 10px;
margin: 1rem auto;
display: grid;
grid-template-columns: repeat(4, 1fr);
padding: 1.5rem;
grid-gap: 1rem;
text-align: center;
}
.calc-container .button-container .button,
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete,
.calc-container .button-container .operation {
border-radius: 10px;
outline: none;
border: none;
font-size: 1.4rem;
cursor: pointer;
background: var(--normalKeyBackground);
box-shadow: 0 5px var(--normalKeyShadow);
/* ADD THIS */
padding-top: 5px;
}
.calc-container .button-container .reset,
.calc-container .button-container .delete {
background: var(--removeKeyBackground);
color: var(--delResetColorText) !important;
box-shadow: 0 5px var(--removeKeyShadow);
}
.calc-container .button-container .reset:hover,
.calc-container .button-container .delete:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .equal {
background: var(--equal_toggle_KeyBackground);
box-shadow: 0 5px var(--equalKeyShadow);
color: var(--equalColorText) !important;
}
.calc-container .button-container .equal:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset,
.calc-container .button-container .equal,
.calc-container .button-container .delete {
color: var(--default);
}
.calc-container .button-container .button,
.calc-container .button-container .operation {
color: var(--normalKeyText);
}
.calc-container .button-container .button:hover,
.calc-container .button-container .operation:hover {
transform: translateY(5px);
box-shadow: none;
}
.calc-container .button-container .reset {
grid-column: 1/3;
}
.calc-container .button-container .equal {
grid-column: 3/5;
}
p {
position: absolute;
left: 50%;
bottom: 1%;
color: white;
font-size: 12px;
transform: translate(-50%, 0);
}
p span {
text-decoration: underline;
}
#media screen and (max-width: 1100px) {
.calc-container {
transform: translate(-50%, 0);
}
.button-container {
width: 300px !important;
}
.screen {
width: 300px !important;
}
header {
width: 300px !important;
}
p {
text-align: center;
width: 80%;
}
}
#media screen and (max-width: 375px) {
.calc-container {
transform: translate(-90%, -15%) !important;
}
input {
-webkit-appearance: none;
background: var(--equal_toggle_KeyBackground);
}
p {
text-align: center;
width: 60%;
}
header {
width: 300px !important;
}
}
/*# sourceMappingURL=style.css.map */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./images/favicon-32x32.png"
/>
<link rel="stylesheet" href="./css/style.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Spartan:wght#700&display=swap"
rel="stylesheet"
/>
<script src="./script.js" defer></script>
<title>Frontend Mentor | Calculator app</title>
</head>
<body>
<main id="main">
<div class="calc-container">
<header>
<h1>calc</h1>
<div class="theme-toggler">
<h2>THEME</h2>
<div>
<div class="label-container">
<label for="input1" class="label">1</label>
<label for="input2" class="label">2</label>
<label for="input3" class="label">3</label>
</div>
<div class="input-container">
<input id="input1" class="input" type="radio" name="theme" />
<input id="input2" class="input" type="radio" name="theme" />
<input id="input3" class="input" type="radio" name="theme" />
</div>
</div>
</div>
</header>
<div class="screen">
<div class="screen-one"></div>
<div class="screen-two"></div>
</div>
<div class="button-container">
<button class="button">7</button>
<button class="button">8</button>
<button class="button">9</button>
<button class="delete">DEL</button>
<button class="button">4</button>
<button class="button">5</button>
<button class="button">6</button>
<button class="operation">+</button>
<button class="button">1</button>
<button class="button">2</button>
<button class="button">3</button>
<button class="operation">-</button>
<button class="button">.</button>
<button class="button">0</button>
<button class="operation">/</button>
<button class="operation">x</button>
<button class="reset">RESET</button>
<button class="equal">=</button>
</div>
</div>
</main>
<p>
Challenge by <span>Frontend Mentor</span>. Coded by
<span>Adrian397</span>.
</p>
</body>
</html>
Related
I could able to get progress bar with below code, but couldn't find solution how to add a small circle on the progress bar ?
HTML
<progress max="100" value="75"></progress>
CSS
progress {
width: 90%;
display: block; /* default: inline-block */
padding: 3px;
border: 0 none;
background: rgb(215, 211, 211);
border-radius: 14px;
}
progress::-moz-progress-bar {
border-radius: 12px;
background: linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%));
}
progress::-webkit-progress-bar {
background: transparent;
}
progress::-webkit-progress-value {
border-radius: 12px;
background: linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%));
}
Add a second background using a radial-gradient
progress {
width: 90%;
display: block; /* default: inline-block */
margin-bottom:1em;
padding: 3px;
border: 0 none;
background: rgb(215, 211, 211);
border-radius: 14px;
}
progress::-moz-progress-bar {
border-radius: 12px;
background: linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%));
}
progress::-webkit-progress-bar {
background: transparent;
}
progress::-webkit-progress-value {
border-radius: 12px;
background: radial-gradient(4px at 97%,white,white 4px,transparent),linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%))
;
}
<progress max="100" value="75"></progress>
<progress max="100" value="50"></progress>
<progress max="100" value="25"></progress>
I have no idea how to add a circle at the end of the progress element, but it is possible to do it with the div element
CSS:
.first{
width: 90%;
display: block; /* default: inline-block */
padding: 3px;
border: 0 none;
background: rgb(215, 211, 211);
border-radius: 14px;
}
.second{
background: linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%));
border-radius: 14px;
height: 10px;
width: 75%;
}
.third{
width: 10px;
background: linear-gradient(to right, hsl(0, 0%, 100%), hsl(0, 0%, 99%));
border-radius: 60px;
height: 8px;
width: 8px;
margin: 1px;
margin-right: 1px !important;
float: right;
margin-right: 0px;
color: white;
}
HTML:
<div class="first">
<div class="second">
<div class="third">.</div>
</div>
</div>
How can I remove this strange black outlines below my buttons. Take a look at my code and its output.
body {
margin: 0;
padding: 0;
box-sizing: border-box;
background: hsl(0, 0%, 95%);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 100vh;
margin: 40px 0;
font-size: 15px;
}
div {
background: white;
width: 85%;
height: 30%;
}
.sedans {
background: hsl(31, 77%, 52%);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
box-sizing: border-box;
padding: 2.9em;
max-width: 450px;
}
h2 {
font-family: "Big Shoulders Display";
color: hsl(0, 0%, 95%);
font-size: 2em;
}
p {
font-family: "Lexend Deca";
color: hsla(0, 0%, 100%, 0.75);
line-height: 1.5em;
padding-bottom: 2em;
}
button {
color: hsl(31, 77%, 52%);
padding: 1em 2.2em;
background: hsl(0, 0%, 95%);
border-radius: 2em;
font-family: "Lexend Deca";
}
div.suvs {
background: hsl(184, 100%, 22%);
box-sizing: border-box;
padding: 2.9em;
max-width: 450px;
}
.suvs button {
color: hsl(184, 100%, 22%);
}
div.luxury {
background: hsl(179, 100%, 13%);
box-sizing: border-box;
padding: 2.9em;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
max-width: 450px;
}
.luxury button {
color: hsl(179, 100%, 13%);
}
.sedans button:hover {
background: hsl(31, 77%, 52%);
color: hsl(0, 0%, 95%);
}
.suvs button:hover {
background: hsl(184, 100%, 22%);
color: hsl(0, 0%, 95%);
}
.luxury button:hover {
background: hsl(179, 100%, 13%);
color: hsl(0, 0%, 95%);
}
#media only screen and (min-width: 1440px) {
body {
flex-direction: row;
margin: auto 100px;
.sedans {
border-top-right-radius: 0;
border-bottom-left-radius: 10px;
border-top-left-radius: 10px;
max-width: 310px;
height: 500px;
}
.suvs {
max-width: 310px;
height: 500px;
}
.luxury {
border-top-right-radius: 10px;
border-bottom-left-radius: 0;
max-width: 310px;
height: 500px;
}
p {
line-height: 1.7em;
}
h2 {
font-size: 2.5em;
}
button {
margin-top: 2em;
}
}
}
<!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>Gerson-web001</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Lexend+Deca&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght#700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="sedans">
<img src="images/icon-sedans.svg" alt="">
<h2>SEDANS</h2>
<p>Choose a sedan for its affordabiity and excellent fuel economy. Ideal for cruising in the city or on your next road trip.</p>
<button>Learn More</button>
</div>
<div class="suvs">
<img src="images/icon-suvs.svg" alt="">
<h2>SUVS</h2>
<p>Take an SUV for its spacious interior, power, and versatility. Perfect for your next family vacation and off-road adventures</p>
<button>Learn More</button>
</div>
<div class="luxury">
<img src="images/icon-luxury.svg" alt="">
<h2>LUXURY</h2>
<p>Cruise in the best car brands without the bloated prices. Enjoy the enhanced comfort of a luxury rental and arrive in style.</p>
<button>Learn More</button>
</div>
</body>
</html>
To remove your button outlines, you can simply set the border: 0 and outline: 0
button {
color: hsl(31, 77%, 52%);
padding: 1em 2.2em;
background: hsl(0, 0%, 100%);
border-radius: 2em;
font-family: "Lexend Deca";
/* Add this to your button tag */
outline: none; /* Optional */
border: 0;
}
I would like to fix the height of each box while using this style.
Here is my CSS and HTML code for this overview-boxes for reference. Probably you will not get the same UI as mine, picture that I put is what I am trying to fix.
If the span gets longer values box height automatically increases. I would like to prevent that outcome while still using this format of overview-items
.ohs-text-overview h2{
font-weight: 300;
color: #fff;
font-size: 36px;
line-height: 1;
margin-bottom: 5px;
}
.ohs-text-overview span{
font-size: 18px;
color: rgba(255, 255, 255, 0.6);
}
/* ----- Overview ----- */
.ohs-overview-wrap {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-moz-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
}
#media (max-width: 767px) {
.ohs-overview-wrap {
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-moz-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.ohs-overview-wrap .button {
-webkit-box-ordinal-group: 2;
-webkit-order: 1;
-moz-box-ordinal-group: 2;
-ms-flex-order: 1;
order: 1;
}
.ohs-overview-wrap h2 {
-webkit-box-ordinal-group: 3;
-webkit-order: 2;
-moz-box-ordinal-group: 3;
-ms-flex-order: 2;
order: 2;
}
}
.ohs-overview-item {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 30px;
padding-bottom: 0;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
margin-bottom: 40px;
}
#media (min-width: 992px) and (max-width: 1519px) {
.ohs-overview-item {
padding-left: 15px;
padding-right: 15px;
}
}
.ohs-overview-item--c1 {
background-image: -moz-linear-gradient(90deg, #3f5efb 0%, #fc466b 100%);
background-image: -webkit-linear-gradient(90deg, #3f5efb 0%, #fc466b 100%);
background-image: -ms-linear-gradient(90deg, #3f5efb 0%, #fc466b 100%);
}
.ohs-overview-item--c2 {
background-image: -moz-linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
background-image: -webkit-linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
background-image: -ms-linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
}
.ohs-overview-item--c3 {
background-image: -moz-linear-gradient(90deg, #ee0979 0%, #ff6a00 100%);
background-image: -webkit-linear-gradient(90deg, #ee0979 0%, #ff6a00 100%);
background-image: -ms-linear-gradient(90deg, #ee0979 0%, #ff6a00 100%);
}
.ohs-overview-item--c4 {
background-image: -moz-linear-gradient(90deg, #45b649 0%, #dce35b 100%);
background-image: -webkit-linear-gradient(90deg, #45b649 0%, #dce35b 100%);
background-image: -ms-linear-gradient(90deg, #45b649 0%, #dce35b 100%);
}
.ohs-overview-box .icon {
display: inline-block;
vertical-align: top;
margin-right: 15px;
}
.ohs-overview-box .icon i {
font-size: 60px;
color: #fff;
}
#media (min-width: 992px) and (max-width: 1199px) {
.ohs-overview-box .icon {
margin-right: 3px;
}
.ohs-overview-box .icon i {
font-size: 30px;
}
}
#media (max-width: 991px) {
.ohs-overview-box .icon {
font-size: 46px;
}
}
<div class="row m-t-25" id="corrective_action_summary_ii" style="text-align: center;">
<div class="col-md">
</div>
<div class="col-sm">
</div>
<div class="col-sm">
<div class="ohs-overview-item ohs-overview-item--c2">
<div class="ohs-overview__inner">
<div class="ohs-overview-box clearfix">
<div class="ohs-text-overview">
<h2>1</h2>
<span>Action Will Described</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm">
<div class="ohs-overview-item ohs-overview-item--c2">
<div class="ohs-overview__inner">
<div class="ohs-overview-box clearfix">
<div class="ohs-text-overview">
<h2>1</h2>
<span>Action Is In Progress</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm">
<div class="ohs-overview-item ohs-overview-item--c2">
<div class="ohs-overview__inner">
<div class="ohs-overview-box clearfix">
<div class="ohs-text-overview">
<h2>0</h2>
<span>Action Completed</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm">
</div>
</div>
.ohs-overview-item {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 30px;
padding-bottom: 0;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.1);
margin-bottom: 40px;
min-height: 120px;
}
adding min-height has solved my problem thanks to gpl
I'm having an issue with my footer. I set up the footer to be a flexbox and I want the "social media" header and icons to wrap onto the second row of the footer but for some reason whenever I set the "container" class to flex-wrap: wrapeverything in the footer becomes aligned vertically down the screen.
.container {
position: relative;
bottom: 0;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-evenly;
align-items: baseline;
background: black;
text-decoration: none;
color: white;
}
.items {
background: transparent;
order: 5;
flex: 1 auto;
color: white;
padding: 40px 0;
width: 100%;
height: auto;
text-align: center;
font-family: Arial, sans-serif;
font-size: 15px;
text-decoration: none;
text-transform: uppercase;
}
.items a {
text-decoration: none;
color: #a2a4a7;
}
.items a:hover {
cursor: pointer;
color: white;
}
#footer-headings {
font-family: 'Cabin Condensed', sans-serif;
font-size: 20px;
padding: 10px;
}
.fa-facebook {
background: #3B5998;
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-twitter {
background: #55ACEE;
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-instagram {
background: radial-gradient(circle farthest-corner at 35% 90%, #fec564, transparent 50%), radial-gradient(circle farthest-corner at 0 140%, #fec564, transparent 50%), radial-gradient(ellipse farthest-corner at 0 -25%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 20% -50%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 0, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 60% -20%, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 100%, #d9317a, transparent), linear-gradient(#6559ca, #bc318f 30%, #e33f5f 50%, #f77638 70%, #fec66d 100%);
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
#media only screen and (max-width: 650px) {
.fa-instagram {
background: radial-gradient(circle farthest-corner at 35% 90%, #fec564, transparent 50%), radial-gradient(circle farthest-corner at 0 140%, #fec564, transparent 50%), radial-gradient(ellipse farthest-corner at 0 -25%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 20% -50%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 0, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 60% -20%, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 100%, #d9317a, transparent), linear-gradient(#6559ca, #bc318f 30%, #e33f5f 50%, #f77638 70%, #fec66d 100%);
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-twitter {
background: #55ACEE;
color: white;
font-size: 10px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-facebook {
background: #3B5998;
color: white;
font-size: 10px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
}
.underline {
display: inline;
position: relative;
overflow: hidden;
}
.underline:after {
content: "";
position: absolute;
z-index: 1;
left: 0;
right: 100%;
bottom: -5px;
background: white;
height: 2.5px;
transition-property: left right;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.underline:hover:after,
.underline:focus:after,
.underline:active:after {
right: 0;
}
#media only screen and (max-width: 650px) {
.items {
font-size: 10px;
}
#footer-headings {
font-size: 10px;
}
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container">
<div class="items">
<p id="footer-headings">Useful Links</p><br>
<p>Find a Store</p><br>
<p>Sign Up For Email</p><br>
<p>Become A Member</p><br>
<p>Site Feedback</p>
</div>
<!-- <div class="vertical-right-1" style="left: 25%; height: 90%; margin: 10px auto; padding: 20px 0; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<strong>
<p id="footer-headings">About The
League</p><br>
</strong>
<p>About Us</p><br>
<p>Careers</p><br>
<p>News</p><br>
<p>Sustainability</p>
</div>
<!-- <div class="vertical-right-1" style="left: 50%; height: 90%; margin: 10px auto; padding: 20px 0; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<p id="footer-headings">
<strong>Policies</strong></p><br>
<p>Terms of service</p><br>
<p>Refund</p><br>
<p>Privacy</p><br>
<p>Shipping</p>
</div>
<!-- <div class="vertical-right-1" style="left: 75%; height: 90%; margin: 10px auto; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<p id="footer-headings">Need To Talk?</p><br>
<p>Order Status</p><br>
<p>Returns</p><br>
<p>Payment Options</p><br>
<p>Contact Us</p><br>
</div>
<div class="items wrap">
<h3 id="footer-headings">Follow Us!</h3><br>
</div>
</div>
Any help with getting the "Follow Us" and the social icons belew it to wrap onto the next row and remain horizontal and ideally centered would be greatly appreciated.
you should use flex-wrap:wrap inside the container, but also remove width:100% from items.
.container {
position: relative;
bottom: 0;
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: baseline;
background: black;
text-decoration: none;
color: white;
}
.full {
/* flex-grow: -1; */
}
.items {
background: transparent;
order: 5;
flex: 1 auto;
color: white;
padding: 40px 0;
/* width: 100%; */
height: auto;
text-align: center;
font-family: Arial, sans-serif;
font-size: 15px;
text-decoration: none;
text-transform: uppercase;
}
.items a {
text-decoration: none;
color: #a2a4a7;
}
.items a:hover {
cursor: pointer;
color: white;
}
#footer-headings {
font-family: 'Cabin Condensed', sans-serif;
font-size: 20px;
padding: 10px;
}
.fa-facebook {
background: #3B5998;
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-twitter {
background: #55ACEE;
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-instagram {
background: radial-gradient(circle farthest-corner at 35% 90%, #fec564, transparent 50%), radial-gradient(circle farthest-corner at 0 140%, #fec564, transparent 50%), radial-gradient(ellipse farthest-corner at 0 -25%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 20% -50%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 0, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 60% -20%, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 100%, #d9317a, transparent), linear-gradient(#6559ca, #bc318f 30%, #e33f5f 50%, #f77638 70%, #fec66d 100%);
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
#media only screen and (max-width: 650px) {
.fa-instagram {
background: radial-gradient(circle farthest-corner at 35% 90%, #fec564, transparent 50%), radial-gradient(circle farthest-corner at 0 140%, #fec564, transparent 50%), radial-gradient(ellipse farthest-corner at 0 -25%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 20% -50%, #5258cf, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 0, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 60% -20%, #893dc2, transparent 50%), radial-gradient(ellipse farthest-corner at 100% 100%, #d9317a, transparent), linear-gradient(#6559ca, #bc318f 30%, #e33f5f 50%, #f77638 70%, #fec66d 100%);
color: white;
font-size: 20px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-twitter {
background: #55ACEE;
color: white;
font-size: 10px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
.fa-facebook {
background: #3B5998;
color: white;
font-size: 10px;
width: 50px;
padding: 15px;
margin: 5px 2px;
border-radius: 50%;
}
}
.underline {
display: inline;
position: relative;
overflow: hidden;
}
.underline:after {
content: "";
position: absolute;
z-index: 1;
left: 0;
right: 100%;
bottom: -5px;
background: white;
height: 2.5px;
transition-property: left right;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.underline:hover:after,
.underline:focus:after,
.underline:active:after {
right: 0;
}
#media only screen and (max-width: 650px) {
.items {
font-size: 10px;
}
#footer-headings {
font-size: 10px;
}
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container">
<div class="items">
<p id="footer-headings">Useful Links</p><br>
<p>Find a Store</p><br>
<p>Sign Up For Email</p><br>
<p>Become A Member</p><br>
<p>Site Feedback</p>
</div>
<!-- <div class="vertical-right-1" style="left: 25%; height: 90%; margin: 10px auto; padding: 20px 0; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<strong>
<p id="footer-headings">About The
League</p><br>
</strong>
<p>About Us</p><br>
<p>Careers</p><br>
<p>News</p><br>
<p>Sustainability</p>
</div>
<!-- <div class="vertical-right-1" style="left: 50%; height: 90%; margin: 10px auto; padding: 20px 0; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<p id="footer-headings">
<strong>Policies</strong></p><br>
<p>Terms of service</p><br>
<p>Refund</p><br>
<p>Privacy</p><br>
<p>Shipping</p>
</div>
<!-- <div class="vertical-right-1" style="left: 75%; height: 90%; margin: 10px auto; ">
</div> -->
<div class="items" style="text-decoration: none; color: white;">
<p id="footer-headings">Need To Talk?</p><br>
<p>Order Status</p><br>
<p>Returns</p><br>
<p>Payment Options</p><br>
<p>Contact Us</p><br>
</div>
<div class="items wrap full">
<h3 id="footer-headings">Follow Us!</h3><br>
</div>
</div>
I am struggling with this overlay. On the prod site the :before element overlays a div with a full image bg. When viewing the site in Chrome and Firefox the content is displayed above the overlay as intended. However, when viewing the content in IE11 the :before element overlays everything in that parent div.
I would like the result in Chrome to be the same in IE.
Ex. Overlay above image, text/content on top of the overlay.
See: JSFiddle
.foreverCTA:before {
content: "";
width: 100%;
height: 900px;
background: #2f71a9;
background: -webkit-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: -o-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: -moz-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: radial-gradient(circle, transparent -25%, #2f71a9 81%);
position: absolute;
left: 0;
}
.foreverCTA {
color: #fff;
/*display: flex;*/
background: #fff url("images/2015APR06_RAYSBASEBALL_MFPB6240s.jpg") no-repeat center;
background-size: cover;
height: 900px;
/*justify-content: center;
flex-wrap: wrap;
align-items: center;*/
}
.foreverCTA p,
.foreverCTA h2,
.foreverCTA h4 {
color: #fff!important;
}
.foreverCTA li,
.foreverCTA ul {
list-style: none;
padding: 0;
}
.foreverCTA p,
.foreverCTA h3,
.foreverCTA h2,
.foreverCTA li {
-webkit-filter: drop-shadow(0px 0px 10px rgba(0, 0, 0, .4));
filter: drop-shadow(0px 0px 10px rgba(0, 0, 0, .4));
}
.ion-ios-baseball {
margin: 3px;
padding-top: 10px;
font-size: 2em;
vertical-align: center;
}
.foreverGame {
margin-top: 50px;
}
.foreverHeader {
padding-top: 50px;
/*-webkit-flex: 1 1 100%;
-moz-flex: 1 1 100%;
-ms-flex: 1 1 100%;
-o-flex: 1 1 100%;
flex: 1 1 100%;
z-index: 999;*/
}
.waysToBuy {
margin: 50px 0;
}
.buyDetails {
min-height: 210px;
text-align: center;
}
.foreverHeader h1,
.waysToBuy h1 {
font-size: 4.5em;
color: #ECDC00!important;
padding: 0!important;
margin: 0;
-webkit-filter: drop-shadow(2px 4px 0px rgba(249, 159, 28, 1));
filter: drop-shadow(2px 4px 0px rgba(249, 159, 28, 1));
}
.foreverHeader h3 {
font-size: 3.5em;
color: #fff!important;
margin: 5px;
}
.foreverBuy {
/*display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: flex-start;*/
}
.buy1,
.buy2 {
height: 400px;
/*display: flex;
flex-direction: column;
justify-content: center;
flex-wrap: wrap;
align-items: flex-end;
flex-basis: 20%;*/
}
.buyDetails {
/*align-self: flex-start;*/
}
.buyButton {
/*flex-basis: 50%;
align-self: center;*/
vertical-align: bottom;
}
.buy2 a {
color: #ECDC00!important;
}
<div class="foreverCTA">
<div class="row">
<div class="foreverHeader">
<h3>Lorem ipsum<br></h3>
<h1>Lorem ipsum<br></h1>
<h3>Lorem ipsum</h3>
</div>
</div>
<div class="row">
<div class="foreverGame">
<h2>Lorem ipsum</h2>
</div>
<div class="foreverDate">
<h3>Lorem ipsum</h3>
</div>
</div>
</div>
This will do the trick,
check this fiddle here
first remove position:absolute property and add following properties as,
display:block;
margin-bottom:-900px;
so your final CSS will be as follows,
.foreverCTA:before {
content: "";
width: 100%;
height: 900px;
background: #2f71a9;
background: -webkit-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: -o-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: -moz-radial-gradient(circle, transparent -25%, #2f71a9 81%);
background: radial-gradient(circle, transparent -25%, #2f71a9 81%);
left: 0;
display:block;
margin-bottom:-900px;
}