I am using this solution:
Text Stroke (-webkit-text-stroke) css Problem
To solve an issue where certain fonts do not display the -webkit-text-stroke properly.
The solution involves overlaying an CSS ::after tag with basically a copy of the text to cover up the inconsistencies.
Here is an example:
.test {
font-family: "Arial";
font-weight: 800;
font-size: 60px !important;
color: rgb(0,0,0);
-webkit-text-stroke: 5.75px rgb(255,9,0) !important;
background-color: null;
text-shadow: 1.68px 1.68px rgb(255 208 130);
text-transform: inherit !important;
top: 0px;
position:relative;
}
.test::after {
content: attr(data-text);
position: absolute;
left: 0;
-webkit-text-stroke: 0;
color: rgb(0,0,0);
pointer-events: none;
margin: inherit;
padding: inherit;
font-size: inherit;
text-shadow: none;
top: inherit;
}
<div class="test" data-text="Pickles">
Pickles
</div>
This works fine until a quote is put into the attribute which will break it.
Here is what happens when you add a quote:
.test {
font-family: "Arial";
font-weight: 800;
font-size: 60px !important;
color: rgb(0,0,0);
-webkit-text-stroke: 5.75px rgb(255,9,0) !important;
background-color: null;
text-shadow: 1.68px 1.68px rgb(255 208 130);
text-transform: inherit !important;
top: 0px;
position:relative;
}
.test::after {
content: attr(data-text);
position: absolute;
left: 0;
-webkit-text-stroke: 0;
color: rgb(0,0,0);
pointer-events: none;
margin: inherit;
padding: inherit;
font-size: inherit;
text-shadow: none;
top: inherit;
}
<div class="test" data-text=""Pickles">
"Pickles
</div>
How can I add a quote into the data attribute or any other special characters for that matter so that the CSS will read it properly?
I have tried escaping it and I have tried to use encodeURI(); but neither of these is working for me.
Write it using " (called HTML entity)
.test {
font-family: "Arial";
font-weight: 800;
font-size: 60px !important;
color: rgb(0, 0, 0);
-webkit-text-stroke: 5.75px rgb(255, 9, 0) !important;
background-color: null;
text-shadow: 1.68px 1.68px rgb(255 208 130);
text-transform: inherit !important;
top: 0px;
position: relative;
}
.test::after {
content: attr(data-text);
position: absolute;
left: 0;
-webkit-text-stroke: 0;
color: rgb(0, 0, 0);
pointer-events: none;
margin: inherit;
padding: inherit;
font-size: inherit;
text-shadow: none;
top: inherit;
}
<div class="test" data-text=""Pickles">
"Pickles
</div>
Related
Is there a way that uses media queries and you can delete the animation for the mobile device but keep the animation for other devices like desktop, or laptop? The same also applies with if you want to add an animation for mobile but not have it on any other device such as laptop or computer. Can you use media queries for this?
For example:
I want to add this animation only on mobile devices
function show() {
setTimeout(
function() {
document.getElementById('discord-shoutout').classList.add('online');
},
200
);
}
function reset() {
hide();
setTimeout(show, 1500);
}
function hide() {
document.getElementById('discord-shoutout').classList.remove('online');
}
show();
html,
body {
background: #e9e9e9;
width: 100%;
height: 100%;
text-align: center;
line-height: 1.1;
}
.reset-button {
font: 400 11px "Open Sans";
line-height: 1;
background: transparent;
border-radius: 10px;
border: 2px solid #7289da;
color: #7289da;
font-size: 1em;
padding: 0.5em 0.8em;
cursor: pointer;
}
.reset-button:hover {
background: #7289da;
color: #fff;
}
.discord-shoutout * {
font-family: "Open Sans", sans-serif;
box-sizing: border-box;
}
.discord-shoutout {
position: fixed;
bottom: 2em;
right: 1em;
width: 300px;
z-index: 100;
text-align: left;
transition: 1s ease;
visibility: hidden;
opacity: 0;
transform: translate(1em, 50px);
filter: drop-shadow(10px 8px 0px rgba(0, 0, 0, 0.15));
}
.discord-shoutout:hover {
filter: drop-shadow(10px 8px 0px rgba(0, 0, 0, 0.25));
}
.discord-shoutout.online {
opacity: 1;
transform: translate(0, 0);
visibility: visible;
}
.discord-shoutout:after {
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 0 50px 50px 0;
border-color: transparent #7289da transparent transparent;
position: absolute;
right: 0;
bottom: -25px;
}
.discord-shoutout .shoutout-inner {
color: #fff;
padding: 1em 1.5em 1.5em;
transition: box-shadow 0.3s ease;
background: transparent;
border-radius: 1em/1em;
overflow: hidden;
position: relative;
}
.discord-shoutout .shoutout-inner:after, .discord-shoutout .shoutout-inner:before {
content: "";
border-width: 0;
position: absolute;
box-sizing: border-box;
width: 100%;
background-color: #7289da;
z-index: -1;
}
.discord-shoutout .shoutout-inner:after {
height: 200%;
top: 0;
left: -46px;
transform: rotate(-18deg);
}
.discord-shoutout .shoutout-inner:before {
height: calc(100% - 25px);
right: 0;
top: 0;
}
.discord-shoutout .title {
display: block;
font-size: 1.2em;
margin: 0 0 1em 0;
}
.discord-shoutout p {
font-size: 0.9em;
font-weight: 300;
margin: 0 0 0.6em 0;
}
.discord-shoutout .discord-buttons {
margin-top: 1.4em;
}
.discord-shoutout .discord-button {
padding: 0.6em 1em;
color: white;
text-decoration: none;
background: transparent;
border: 0;
font-size: 0.9em;
cursor: pointer;
}
.discord-shoutout .discord-button.discord-primary {
border: 2px solid #fff;
border-radius: 6px;
}
.discord-shoutout .discord-button.discord-primary:hover {
background: #fff;
color: #7289da;
}
.discord-shoutout .discord-button.discord-secondary {
color: #fff;
}
.discord-shoutout .discord-button.discord-secondary:hover {
text-decoration: underline;
}
.discord-shoutout img {
position: absolute;
right: 1em;
top: 1em;
height: 1.4em;
}
<button class="reset-button" onclick="reset()">reset</button>
<div id="discord-shoutout" class="discord-shoutout">
<div class="shoutout-inner">
<img src="https://discordapp.com/assets/93608abbd20d90c13004925014a9fd01.svg">
<span class="title">Hey there!</span>
<p>
Fancy having a chat?
</p>
<p>
We're currently online on Discord!
</p>
<div class="discord-buttons">
<a class="discord-button discord-primary" href="https://discord.gg/2nrFVCp" target="_blank">Join our server</a>
<button class="discord-button discord-secondary" onclick="hide()">Close</button>
</div>
</div>
</div>
Is there a way to add the above animation only for mobile devices? using either media queries or any other method?
I can think of two ways of doing it. One with media queries and another with javascript. I prefer the media query way. In below code the animation will only work on screen sizes less than 600px. That is it will only work on mobile devices.
Media query way:
You can add the css which toggles the animation inside a media query
CSS:
html,
body {
background: #e9e9e9;
width: 100%;
height: 100%;
text-align: center;
line-height: 1.1;
}
.reset-button {
font: 400 11px "Open Sans";
line-height: 1;
background: transparent;
border-radius: 10px;
border: 2px solid #7289da;
color: #7289da;
font-size: 1em;
padding: 0.5em 0.8em;
cursor: pointer;
}
.reset-button:hover {
background: #7289da;
color: #fff;
}
.discord-shoutout * {
font-family: "Open Sans", sans-serif;
box-sizing: border-box;
}
.discord-shoutout {
position: fixed;
bottom: 2em;
right: 1em;
width: 300px;
z-index: 100;
text-align: left;
transition: 1s ease;
visibility: hidden;
opacity: 0;
transform: translate(1em, 50px);
filter: drop-shadow(10px 8px 0px rgba(0, 0, 0, 0.15));
}
.discord-shoutout:hover {
filter: drop-shadow(10px 8px 0px rgba(0, 0, 0, 0.25));
}
.discord-shoutout:after {
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 0 50px 50px 0;
border-color: transparent #7289da transparent transparent;
position: absolute;
right: 0;
bottom: -25px;
}
.discord-shoutout .shoutout-inner {
color: #fff;
padding: 1em 1.5em 1.5em;
transition: box-shadow 0.3s ease;
background: transparent;
border-radius: 1em/1em;
overflow: hidden;
position: relative;
}
.discord-shoutout .shoutout-inner:after, .discord-shoutout .shoutout-inner:before {
content: "";
border-width: 0;
position: absolute;
box-sizing: border-box;
width: 100%;
background-color: #7289da;
z-index: -1;
}
.discord-shoutout .shoutout-inner:after {
height: 200%;
top: 0;
left: -46px;
transform: rotate(-18deg);
}
.discord-shoutout .shoutout-inner:before {
height: calc(100% - 25px);
right: 0;
top: 0;
}
.discord-shoutout .title {
display: block;
font-size: 1.2em;
margin: 0 0 1em 0;
}
.discord-shoutout p {
font-size: 0.9em;
font-weight: 300;
margin: 0 0 0.6em 0;
}
.discord-shoutout .discord-buttons {
margin-top: 1.4em;
}
.discord-shoutout .discord-button {
padding: 0.6em 1em;
color: white;
text-decoration: none;
background: transparent;
border: 0;
font-size: 0.9em;
cursor: pointer;
}
.discord-shoutout .discord-button.discord-primary {
border: 2px solid #fff;
border-radius: 6px;
}
.discord-shoutout .discord-button.discord-primary:hover {
background: #fff;
color: #7289da;
}
.discord-shoutout .discord-button.discord-secondary {
color: #fff;
}
.discord-shoutout .discord-button.discord-secondary:hover {
text-decoration: underline;
}
.discord-shoutout img {
position: absolute;
right: 1em;
top: 1em;
height: 1.4em;
}
#media only screen and (max-width: 600px) {
.discord-shoutout.online {
opacity: 1;
transform: translate(0, 0);
visibility: visible;
}
}
Javascript way: You can also check window width in js and toggle the animation class accordingly.
JS:
function show() {
if(window.innerWidth < 600){
setTimeout(
function() {
document.getElementById('discord-shoutout').classList.add('online');
},
200
);
}
}
function reset() {
hide();
setTimeout(show, 1500);
}
function hide() {
document.getElementById('discord-shoutout').classList.remove('online');
}
show();
you can use this for disable all animations on only mobiles devices you can ajust the media query size for your purposes....
#media screen and (max-width: 768px) {
*, *:before, *:after {
/*CSS transitions*/
transition-property: none !important;
/*CSS transforms*/
transform: none !important;
/*CSS animations*/
animation: none !important;
}
I'm making some accordion FAQ questions. When I add padding around the answer portion, my accordion won't close all the way. When I remove the padding, the accordion works fine. The problem is that I want the padding.
As stated before, my accordion works perfectly fine when padding is removed. When the padding is added back, the collapsed answer still shows the first few lines of text in the answer.
(The accordion in question is the last entry on the page, headed with "0002.")
body {
font-family: 'work sans', Arial, sans-serif;
font-size: 14px;
color: #999;
margin: 0px;
padding: 0px;
background-color: #010101;
background: url(https://imgur.com/YRl8KNP.png) fixed center;
background-size: cover;
text-align: left;
}
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
::-webkit-scrollbar-track {
background-color: #000;
}
::-webkit-scrollbar-thumb {
background-color: #010101;
}
a:link,
a:visited,
a:active {
text-decoration: none;
color: #999;
}
#header {
padding: 160px;
}
.h_title {
font: 150px 'work sans';
color: #fff;
margin-left: 45px;
text-transform: uppercase;
}
.h_menu {
border-top: 1px solid #999;
width: 1100px;
margin: 0 auto;
padding: 20px 0px;
margin-bottom: 175px;
}
.h_top {
text-align: right;
font: 12px 'work sans';
color: #fff;
text-transform: uppercase;
letter-spacing: 4px;
font-weight: 900;
}
.h_top::before {
content: '////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////';
font: 11px 'arial';
font-weight: 400;
display: block;
color: #ff00ff;
margin-bottom: 20px;
letter-spacing: 4px;
}
.h_tabs input {
display: none;
}
.h_tabs {
position: relative;
overflow: hidden;
height: 230px;
margin-top: 30px;
}
.h_tabs label {
position: absolute;
right: 0px;
top: 20px;
font: 9px 'work sans';
letter-spacing: 5px;
color: #fff;
cursor: crosshair;
}
.h_tabs label:nth-of-type(2) {
top: 90px;
}
.h_tabs label:nth-of-type(3) {
top: 160px;
}
.h_tabs label b {
color: #ff00ff;
font-weight: 700;
}
.h_tabs label span {
opacity: 0;
transition: 0.6s;
}
.h_tabs label:after {
content: '001';
display: inline-block;
overflow: hidden;
width: 40px;
text-align: right;
font-eight: 100;
color: #fff;
transition: 0.6s;
font-weight: bold;
}
.h_tabs label:nth-of-type(2):after {
content: '002';
}
.h_tabs label:nth-of-type(3):after {
content: '003';
}
.h_tabs input:checked+label span {
opacity: 1;
transition: 0.6s;
}
.h_tabs input:checked+label::after {
width: 0px;
transition: 0.6s;
}
.h_tab1,
.h_tab2 {
width: 700px;
position: absolute;
left: 50px;
top: 50px;
opacity: 0;
}
.h_blurb {
font: 14px 'work sans';
color: #ccc;
letter-spacing: 1px;
}
.h_cont {
background: #171717;
padding: 20px;
margin-top: 25px;
overflow: hidden;
display: inline-block;
}
.h_nav a {
display: inline-block;
position: relative;
width: 180px;
margin: 0px 35px 15px 0px;
border-bottom: 1px solid #333;
padding: 6px;
font: 12px 'share tech mono';
text-transform: uppercase;
letter-spacing: 1px;
color: #aaa;
}
.h_nav a::after {
content: '';
width: 15px;
height: 2px;
position: absolute;
left: 0;
bottom: -1px;
background: #ff00ff;
transition: 0.5s;
}
.h_nav a:nth-of-type(2n):after {
background: #ff00ff;
}
.h_nav a:nth-of-type(3n):after {
background: #ff00ff;
}
.h_nav a:hover:after {
width: 180px;
transition: 0.5s;
}
#htab1:checked~.h_tab1,
#htab2:checked~.h_tab2 {
opacity: 1;
z-index: 2;
}
#lean_overlay {
position: fixed;
z-index: 99;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
background: url(https://i.imgur.com/zdXP0Uo.jpg) fixed center;
background-size: cover;
display: none;
}
#Pages #wrapper {
background: transparent;
}
#page_container {
width: 1100px;
overflow: hidden;
padding: 15px 0px;
margin: 15px 0px;
}
.page_menu {
font: 12px 'share tech mono';
width: 220px;
margin-right: 50px;
margin-left: 12px;
float: left;
}
.page_menu a:active {
color: #ff00ff;
}
.page_menu h1 {
font: 17px 'work sans';
font-weight: 700;
text-transform: lowercase;
color: #fff;
margin: 30px 0px 10px 0px;
}
.page_menu h1:before {
content: '/ ';
font-weight: 300;
margin-right: 5px;
color: #ccc;
}
.page_content {
background: #171717;
width: 705px;
float: left;
outline: 1px solid rgba(255, 255, 255, 0.2);
outline-offset: 10px;
padding: 50px;
text-align: justify;
line-height: 150%;
}
.page_content h1 {
font: 50px 'work sans';
text-transform: uppercase;
font-weight: 300;
color: #fff;
margin: 0px;
overflow: hidden;
text-align: left;
display: block;
letter-spacing: 1px;
}
.page_content h2 {
font: 15px 'share tech mono';
text-transform: lowercase;
letter-spacing: 1px;
margin: 10px 0px;
color: #ff00ff;
}
.page_text {
padding: 20px 50px;
}
.page_text u {
color: #fff;
text-transform: uppercase;
font-weight: 700;
letter-spacing: 1px;
text-decoration: none;
font-size: 12px;
}
.page_em {
margin: 30px;
font: 10px 'share tech mono';
line-height: 17px;
border: 1px solid #333;
padding: 30px;
}
.page_em u {
color: #ff00ff;
font-style: normal;
font-size: 10px;
letter-spacing: 0px;
line-height: 17px;
text-transform: uppercase;
text-decoration: none;
font-weight: 700;
}
.page_menu ol {
counter-reset: item;
margin: 0px;
padding-left: 10px;
}
.page_menu li ol {
padding-left: 15px;
}
.page_menu b {
color: #ff00ff;
font-weight: bold;
}
.page_menu ol li {
display: block;
}
.page_menu li:before {
content: counters(item, ".") ". ";
counter-increment: item;
font-size: 9px;
line-height: 25px;
color: #ff00ff;
}
.sub_canons li {
border-top: 1px solid #333;
border-bottom: 1px solid #333;
font: 7px 'work sans';
text-transform: uppercase;
letter-spacing: 1px;
padding: 20px 0px;
margin-bottom: 10px;
}
.sub_canons {
list-style-type: none;
margin: 30px 0px;
padding-left: 50px;
}
.sub_canons li b {
display: block;
font: 10px 'share tech mono';
}
.page_content h3 {
font: 14px 'share tech mono';
text-align: right;
text-transform: lowercase;
letter-spacing: 1px;
margin: 20px 0px;
color: #fff;
counter-increment: faqcounter;
}
.page_content h3::before {
content: '00' counter(faqcounter, decimal-leading-zero);
margin-right: 12px;
color: #ff00ff;
}
.page_content h4 {
font: 13px 'share tech mono';
text-transform: lowercase;
letter-spacing: 1px;
margin: 20px 0px;
color: #fff;
counter-increment: faqcounter;
}
.page_content h4::before {
content: '00' counter(faqcounter, decimal-leading-zero);
margin-right: 10px;
color: #ff1053;
}
.page_content h5 {
font: 13px 'share tech mono';
text-transform: lowercase;
letter-spacing: 1px;
margin: 20px 0px;
color: #fff;
counter-increment: faqcounter;
}
.page_content h5::before {
content: '00' counter(faqcounter, decimal-leading-zero);
margin-right: 10px;
color: #4592f7;
}
.page_content h6 {
font: 13px 'share tech mono';
text-transform: lowercase;
letter-spacing: 1px;
margin: 20px 0px;
color: #fff;
counter-increment: faqcounter;
}
.page_content h6::before {
content: '00' counter(faqcounter, decimal-leading-zero);
margin-right: 10px;
color: #ff5f32;
}
/* Tagging */
a.user-tagged.mgroup-4 {
color: #744dba;
}
a.user-tagged.mgroup-8 {
color: #ff1053;
}
a.user-tagged.mgroup-6 {
color: #4592f7;
}
a.user-tagged.mgroup-7 {
color: #ff5f32;
}
.iconpad {
padding: 10px;
border: 1px solid #222;
margin-right: 10px;
float: left;
margin-top: 5px;
}
.padex {
padding: 10px;
text-align: justify;
}
::-moz-selection {
color: #ff00ff;
}
::selection {
color: #ff00ff;
}
faqentry {
margin: 0px 20px 5px 20px;
display: block;
}
faqentry ol li {
margin: 10px 15px 10px 10px;
padding-left: 15px;
font-size: 9px;
color: #d8fe56;
}
div.toggle {
margin: 10px 30px 20px 30px;
padding: 40px;
line-height: 170%!important;
background: rgba(0, 0, 0, 0.3);
display: block;
}
<!DOCTYPE html>
<html>
<head>
<style>
.accordion {
font: 14px 'share tech mono';
text-align: right;
text-transform: lowercase;
letter-spacing: 1px;
margin: 20px 0px;
color: #fff;
background: none;
border: none;
transition: 0.4s;
}
div.panel {
margin: 10px 30px 20px 30px;
padding: 40px;
line-height: 170%;
background: rgba(0, 0, 0, 0.3);
display: block;
max-height: 0;
overflow: hidden;
transition: 0.2s ease-out;
}
</style>
<link rel="shortcut icon" href="HERE">
<link href="https://fonts.googleapis.com/css?family=Work+Sans:100,400,700,900|Share+Tech+Mono" rel="stylesheet">
<title>STICTION</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<LINK REL=StyleSheet HREF="STICTION.css" TYPE="text/css">
</head>
<div id="header">
<div class="h_title">stiction</div>
<div class="h_menu">
<div class="h_top"></div>
<div class="h_tabs">
<input id="htab1" type="radio" name="htabs" checked>
<label for="htab1"><span>CANDY TEETH, NEON IDIOTS.</span> <b>/</b></label>
<input id="htab2" type="radio" name="htabs">
<label for="htab2"><span>OTHER LINKS</span> <b>/</b></label>
<div class="h_tab1">
<div class="h_blurb"><i>Welcome to the new world; myth meets the future. Where do you fit in?</i><br><br>
<span style="text-transform: uppercase; font-family: share tech mono; font-size: 11px;">literate supernatural and cyberpunk group roleplay set in City 0215 during the year 2447.</span>
</div>
</div>
<div class="h_tab2">
<div class="h_nav">
DISCORD
DIRECTORY
PLAYLIST
</div>
</div>
</div>
</div>
<div id="page_container">
<div class="page_menu">
<ol>
<li>INDEX</li>
</ol>
<h1>ESSENTIAL READS</h1>
<ol>
<li>QUICK-START GUIDE</li>
<span style="color: #ff00ff; font-weight: bold;">RULES</span>
<li>HISTORY</li>
<li>SETTING</li>
<li>SPECIES</li>
<ol>
<li>LIVING</li>
<li>DECEASED</li>
<li>PRUGATORIC</li>
</ol>
</ol>
<h1>IN-DEPTH CONTENT</h1>
<ol>
<li>FAQ</li>
<li>SUBPLOTS</li>
<ol>
<li>SUBPLOT 001</li>
<li>SUBPLOT 002</li>
<li>SUBPLOT 003</li>
</ol>
<li>OFFICIAL SERVER FACTIONS</li>
<li>MEMBER-CREATED FACTIONS</li>
</ol>
</div>
<div class="page_content">
<div class="page_text" id="top">
<h1>lore questions</h1>
<div class="page_em"><u>A NOTE</u> This world- the world of <u style="color: #4fecc8; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; font-size: 7px; font-family: 'work sans', Arial, sans-serif;">STICTION</u>- isn't just the project and product of
the staff team. We want you to feel that you can contribute to this world! To that end, these are all questions that guests and members have asked in our Discord. Questions are either answered according to existing lore, or (in cases where the
staff team hasn't thought of a situation or scenario) are talked out with members to come to a satisfying answer. This page is updated regularly, so make sure you keep an eye on it!
<p>
It's probably easiest to explore this page using the <b>CRTL+F</b> function, especially if you have specific questions!</div>
<h2>quick links</h2>
<faqentry id="quick links">
<ol>
<li><u>world-building</u></li>
<li><u>subplots</u></li>
<ol>
<li><u>crossed wires subplot</u></li>
<li><u>live for the applause subplot</u></li>
<li><u>blood and chocolate subplot</u></li>
</ol>
<li><u>species-specific</u>
<ol>
<li><u>general abilities</u></li>
<li><u>witches</u></li>
<li><u>shifters</u></li>
<li><u>vampires</u></li>
<li><u>reapers</u></li>
<li><u>ghosts</u></li>
<li><u>phoenixes</u></li>
<li><u>familiars</u></li>
<li><u>androids</u></li>
</ol>
</ol>
</faqentry>
<a name="section"> </a>
<Br><br>
<h2>world-building</h2>
<h3>context clues</h3>
Before you get started exploring this new world, it’s helpful to keep in mind a few things for context! (It might even help you answer your own questions, who knows?) The first bit of info you’ll need is that electricity and all other forms of energy
are obsolete; instead, the world runs on magic energy. That leads into point two, which is that supernatural, magic creatures are no longer monsters under the bed, or creatures in the shadow; they live open, public lives.<br><br> Since
this is a cyberpunk site, it stands to reason that technology is wildly more advanced than what we have now. It’s no so advanced that interstellar travel exists, but it’s so much farther ahead that paper (and privacy, in a lot of ways) is a thing
of the past. Every person on the planet is in some way connected to the Global Communications Lattice (or GCL) for short, and everything on the planet runs through it. As far as specific pieces of technology go, that’s largely up to you, your
ideas, and genre standards.<br>
<Br> It never hurts to ask an admin or run an idea by us before executing an idea, though!
<button class="accordion"><h3>What's the primary language spoken in City 0023? What about the rest of the world?</h3></button>
<div class="panel">English has become the primary language of most of the world, but thanks to the ease of information access, every language (even dead languages) can be learned now! Linguistic diversity not only still exists in this world, but is flourishing;
most people can claim some form of bilingualism. English, French, and Chinese are the top three languages spoken in City 0023.</div>
<br>
<Br>
<u>Back to Top</u>
</div>
</div>
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
</script>
To answer your original question, as you discovered, as long as that .panel div has top and bottom padding, it will have an intrinsic minimum height which is why it wasn't closing all the way.
The easiest way I can think of to achieve the desired result without changing too much of your existing code is to nest the text inside a div that is a child of .panel and move the padding property (and optionally the line-height property as well) to the nested element (which I called .panel__content -- you can call it whatever you want).
div.panel {
margin:10px 30px 20px 30px;
background:rgba(0,0,0,0.3);
display:block;
max-height: 0;
overflow: hidden;
transition: 0.2s ease-out;
}
.panel__content {
padding:40px;
line-height: 170%;
}
<div class="panel">
<div class="panel__content">English has become the primary language of most of the world, but thanks to the ease of information access, every language (even dead languages) can be learned now! Linguistic diversity not only still exists in this world, but is flourishing; most people can claim some form of bilingualism. English, French, and Chinese are the top three languages spoken in City 0023.</div>
</div>
Working JSFidddle example
Some side notes:
I would also highly recommend that you validate your HTML and CSS, as you have a number of validation errors currently. Best way to do that is to paste your code into W3C's online validators:
HTML Validator:
https://validator.w3.org/#validate_by_input
CSS Validator:
https://jigsaw.w3.org/css-validator/#validate_by_input
You might not need to add div to your .panel selector to achieve the same result. All things being equal, it's a best practice to have selectors be as short as possible.
You might not need to set .panel to display:block; as div's have this property value by default.
Try adding
box-sizing: border-box;
On your panel. This should make it so the padding is a part of height. You may have to adjust other values if that shifts things slightly.
Otherwise, you could set padding top and bottom to 0 when closed and transition those values as well, when collapsing.
max-height property overrides the height property but the padding top and bottom value will added to the height when css is getting compiled and value of height well be 80px
so set the padding to
div.panel { padding: 0 40px }
and change your script to
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight){
panel.style.maxHeight = null;
panel.style.paddingTop = 0;
panel.style.paddingBottom = 0
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
panel.style.paddingTop = null;
panel.style.paddingBottom = null
}
})
}
I have a HTML and CSS code, and it works fine on Chrome. However, on Firefox, the behavior is different.
button#groupToggle {
background: 0 0;
border: 1px solid #e6e6ed;
color: #222;
float: none;
margin: 0 0 0 6px;
min-width: 200px;
padding: 8px 10px;
position: relative;
text-align: left;
cursor: pointer;
}
button#groupToggle::after {
background: #FFF;
border: 1px solid #e6e6ed;
color: #f8971d;
content: '>';
display: inline-block;
font: 900 12px/2.1 'Font Awesome 5 Free';
height: calc(100% + 1px);
left: 100%;
position: absolute;
text-align: center;
top: -1px;
width: 2em;
cursor: pointer;
border: ;
}
<button id="groupToggle">
<span>All selected</span>
</button>
After the All Selected, there is a button that is created through pseudo CSS (after). It can be clicked when hovering on Chrome but not on Firefox. Any thoughts?
Firefox version: 64.0
Link: https://codepen.io/anon/pen/zymvPj (Please use Firefox to test it).
There actually is no way to make it behave the same way as it does in Chrome. :after and :before are not treated as DOM elements by Firefox. You can however, cheat it a little bit. Changing behave for all browsers. That is my proposition of solution to look the same and behave as you would like it to do.
button#groupToggle {
background: 0 0;
border: 1px solid #e6e6ed;
color: #222;
float: none;
margin: 0 0 0 6px;
min-width: 224px;
/* increased by 24px (after width) */
padding: 8px 10px;
position: relative;
text-align: left;
cursor: pointer;
z-index: 0;
}
button#groupToggle::after {
background: #FFF;
border: 1px solid #e6e6ed;
color: #f8971d;
content: '>';
display: inline-block;
font: 900 12px/2.1 'Font Awesome 5 Free';
height: calc(100% + 1px);
position: absolute;
text-align: center;
top: -1px;
width: 2em;
position: absolute;
cursor: pointer;
border: ;
right: -1px;
/* -1px to neutralize border */
}
/* ONLY TO SHOW IT WORKING */
button#groupToggle:focus {
outline: red solid 10px;
-moz-outline: red solid 10px
}
<button id="groupToggle">
<span>All selected</span>
</button>
Font-Awesome 5 - Pseudo-elements
Requirements for Free Solid Version
Have this in the <head> tag:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
In your stylesheet:
.icon::after {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
}
.arrow::after {
content: '\f105';
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
The content property needs Unicode not >
Those two classes names are arbitrary but be sure that they are on the same tag:
<button class='icon arrow'></button>
Absolute Positioning
Font-Awesome (or lack thereof) wasn't the problem, but I had to address the elephant in the room. Anyhow, left:100% pushed the part out of the button's border and looks as if Firefox treats the pseudo-element like it doesn't belong to the button, while apparently Chrome remembers. The solution is simply: remove left:100% and add right:0
Demo
button#groupToggle {
background: 0 0;
border: 1px solid #e6e6ed;
color: #222;
float: none;
margin: 0 0 0 6px;
min-width: 200px;
padding: 8px 10px;
position: relative;
text-align: left;
cursor: pointer;
}
.icon::after {
background: #FFF;
border: 1px solid #e6e6ed;
color: #f8971d;
font-size: 12px;
line-height: 2.7;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
height: calc(100% + 1px);
right: 0;
position: absolute;
text-align: center;
top: -1px;
width: 2em;
cursor: pointer;
}
button#groupToggle::after {
content: '\f105';
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
<button id="groupToggle" class='icon'>
<span>All selected</span>
</button>
I need my div to shift to and fro when clicked, like only one div should show on load and the other should not be visible and when clicked should come into view and vice versa , any kind of transition, i dont wish to use slick carousel, don't know where i went wrong cant figure out why even the inline block doesn't work.
function step(n) {
if (n == 1) {
$(".agever").animate({
"left": "-300px"
}, "slow");
} else if (n == 2) {
$(".contever").animate({
"right": "300px"
}, "slow");
}
}
.light {
background: url(images/background.jpg) no-repeat;
background-size: 100%;
}
img#bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#import url(http://fonts.googleapis.com/css?family=Raleway);
body {
margin: 0px;
}
.footer {
float: left;
background-color: #0f0f0e;
color: #fff;
text-align: center;
padding: 20px 0;
bottom: 0px;
top: 125px;
width: 100%;
position: relative;
opacity: .7;
bottom: 0;
}
.agever {
position: relative;
text-align: center;
background-color: rgba(252, 251, 227, 0.1);
width: 800px;
height: 325px;
border: 2px solid #ffffff;
margin-left: 100px;
margin-bottom: 250px;
top: 150px;
}
.agetitle {
color: #a88d2e;
color: rgb(168, 141, 46);
background-color: #000000;
background-color: rgba(0, 0, 0, 0);
font-family: Montserrat;
font-size: 18px;
line-height: 28.8px;
vertical-align: baseline;
letter-spacing: normal;
word-spacing: 0px;
font-weight: bolder;
font-style: normal;
font-variant: normal;
text-transform: none;
text-decoration: none;
text-align: center;
text-indent: 0px;
padding-top: 40px;
}
.policy,
.policy a {
text-decoration: none;
color: #9b9b9b;
color: rgb(155, 155, 155);
background-color: #000000;
background-color: rgba(0, 0, 0, 0);
font-family (stack): Montserrat;
font-size: 13px;
line-height: 28.8px;
vertical-align: baseline;
letter-spacing: normal;
word-spacing: 0px;
font-weight: bolder;
font-style: normal;
font-variant: normal;
text-transform: none;
text-decoration: none;
text-align: center;
text-indent: 0px;
}
.yes a {
text-decoration: none;
font-family: Roboto, sans-serif;
font-size: 14px;
line-height: 21px;
vertical-align: baseline;
letter-spacing: 0.28px;
word-spacing: 0px;
font-style: normal;
font-variant: normal;
text-transform: uppercase;
text-align: center;
text-indent: 0px;
}
.no a {
text-decoration: none;
font-family: Roboto, sans-serif;
font-size: 14px;
line-height: 21px;
vertical-align: baseline;
letter-spacing: 0.28px;
word-spacing: 0px;
font-style: normal;
font-variant: normal;
text-transform: uppercase;
text-align: center;
text-indent: 0px;
}
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 30px;
text-align: center;
font-weight: bolder;
display: inline-block;
font-size: 16px;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
cursor: pointer;
}
.button1 {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 15px;
text-align: center;
font-weight: bolder;
display: inline-block;
font-size: 16px;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
cursor: pointer;
}
.button5 {
background-color: #2b2b2b;
color: #ffffff;
border: 2px solid #555555;
}
.button5:hover {
background-color: #555555;
color: white;
}
.contever {
position: relative;
background-color: rgba(252, 251, 227, 0.1);
width: 950px;
height: 625px;
border: 2px solid #ffffff;
margin-left: 25px;
margin-bottom: 250px;
top: 50px;
overflow-y: scroll;
}
::-webkit-scrollbar {
width: 18px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.3);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.5);
}
.tandpcontent {
color: #f6f5d8;
font-family: Montserrat font-size: 16px text-align: left;
padding-left: 15px;
padding-right: 15px;
line-height: 19.8px
}
.tandptitle {
color: #a88d2e;
color: rgb(168, 141, 46);
background-color: #000000;
background-color: rgba(0, 0, 0, 0);
font-family: Montserrat;
font-size: 30px;
line-height: 28.8px;
vertical-align: baseline;
letter-spacing: normal;
font-weight: bolder;
text-decoration: none;
text-align: center;
text-indent: 0px;
padding-top: 40px;
text-align: center;
}
.close-icon {
position: relative;
top: 30px;
left: 955px;
display: block;
box-sizing: border-box;
width: 40px;
height: 40px;
border-width: 6px;
border-style: solid;
border-color: gray;
border-radius: 100%;
background: -webkit-linear-gradient(-45deg, transparent 0%, transparent 46%, white 46%, white 56%, transparent 56%, transparent 100%), -webkit-linear-gradient(45deg, transparent 0%, transparent 46%, white 46%, white 56%, transparent 56%, transparent 100%);
background-color: gray;
box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.5);
transition: all 0.3s ease;
}
#tandpchange {
cursor: pointer;
}
#containblockd {
display: inline-block;
overflow: hidden;
}
#tandpmaster {
display: hidden;
overflow: hidden;
float: left;
}
agemaster {
display: inline-block;
overflow: hidden;
float: left;
}
<div id="containblockd">
<div id="agemaster">
<div class="agever">
<p class="agetitle">
YOU MUST BE OF LEGAL DRINKING AGE IN THE COUNTRY IN WHICH YOU ARE ACCESSING THIS SITE
</p>
<p class="yes">
<a href="main.html">
<button class="button button5">YES I AM OF LEGAL DRINKING AGE</button>
</a>
</p>
<p class="no">
<a href="https://www.google.co.in/search?site=&source=hp&q=kingspirits.net&oq=kingspirits.net&gs_l=hp.3...518.518.0.1500.2.2.0.0.0.0.155.262.0j2.2.0....0...1c.1.64.hp..0.0.0.0.ZgyZZmdP464">
<button class="button1 button5">NO,I AM NOT OF LEGAL DRINKING AGE</button>
</a>
</p>
<p class="policy">
By entering this site you agree to our <a title="Law" onclick=" step(1)" id="tandpchange">Terms & Privacy Policy.</a>
</p>
</div>
</div>
<div id="tandpmaster">
<div class="contever">
<p class="tandptitle">
TERMS & PRIVACY POLICY
</p>
<p class="tandpcontent">
some content.....
</p>
</div>
</div>
Animate by itself doesn't show or hide elements.
So you should add the hiding and showing logic in the complete function, as follows, by example (or using animation parameters in show and hide)
function step(n) {
if (n == 1) {
$(".agever").animate({
"left": "-300px"
}, "slow", function(){
$(".agever").hide();
$(".contever").show();
});
} else if (n == 2) {
$(".contever").animate({
"right": "300px"
}, "slow",function(){
$(".agever").show();
$(".contever").hide();
});
}
}
Moreover you should also handle the positions of your DIVs after they have been shown, hidden and shown again as the DIVs will return in the position reached after each animation.
I was really unsure what to title this question so I think the best way to explain is with a snippet:
$(document).ready(function () {
$(".navbar-toggle").on("click", function () {
$(".navbar").toggleClass("open");
$(".navbar-toggle").toggleClass("open");
});
});
html {
font-family: "Raleway", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
font-weight: normal;
color: #888;
}
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
p {
margin: 0;
padding: 0;
font-weight: normal;
}
a {
text-decoration: none;
color: inherit;
}
button {
border: none;
-webkit-appearance: button;
cursor: pointer;
}
.navbar {
background: rgba(255, 236, 176, 0.97);
color: #555;
line-height: 50px;
display: none;
position: relative;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
z-index: 99;
}
.navbar-fixed {
position: fixed;
top: 0;
}
.navbar-brand {
display: inline-block;
padding: 0 15px;
}
.navbar-mobile {
background: #ffecb0;
position: fixed !important;
top: -100%;
display: block;
height: 275px;
width: 100%;
overflow-y: auto;
opacity: 0.0;
transition: .3s ease
}
.navbar.open {
opacity: 1.0;
top: 0;
}
.navbar-mobile .container {
padding: 0;
}
.navbar-toggle {
background: #ffecb0;
position: fixed;
display: block;
top: 10px;
left: 15px;
padding: 9px 10px;
border-radius: 5px;
z-index: 100;
background-image: none;
outline: none;
}
.navbar-toggle .icon-bar {
background-color: #555;
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
transition: .3s ease;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top: 4px;
}
.navbar-toggle.open .icon-bar:first-child {
transform: translate(0, 6px) rotate(225deg);
}
.navbar-toggle.open .icon-bar:nth-child(2) {
opacity: 0;
}
.navbar-toggle.open .icon-bar:last-child {
transform: translate(0, -6px) rotate(135deg);
}
nav ul {
list-style: none;
text-align: center;
}
nav a {
position: relative;
display: block;
font-size: 16px;
font-weight: 500;
}
nav li a:hover {
color: black;
background-color: #ffe389;
}
nav li a.active {
color: white;
background-color: #847d64;
}
.btn {
}
.navbar-button {
color: #fff;
display: inline-block;
border-radius: 5px;
font-size: 16px;
font-weight: 500;
letter-spacing: 1px;
text-align: center;
overflow: hidden;
transition: .3s;
background-color: #a48eff;
border-color: #8c6aff;
line-height: 1;
padding: 10px 10px;
margin: 0 15px;
}
.navbar-button:hover {
background-color: #b9a8ff;
color: white;
border-color: #ad94ff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="navbar-toggle" type="button" role="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<nav class="navbar navbar-mobile">
<div class="container">
<div class="navbar-items">
<ul>
<li>Home</li>
<li>Link 2</li>
<li>Link 3</li>
<li><a class="button navbar-button" href="contact.html">Call to Action</a></li>
</ul>
</div>
</div>
</nav>
As you can see I have a mobile navbar collapse/expand button which is working fine. But for some reason, only in Mac OS Safari, when the button is clicked something is getting selected and the blue highlight is appearing.
I have no idea what is causing this and I've tried a few different ideas to fix it. As you can see I tried adding onfocus="blur()" to the button but that didn't work. I also tried adding user-select: none; to the button and also the span tags inside but that didn't work either.
It's not a massive issue because usually this button will only be visible when the user is looking at my website on their phone and the problem doesn't occur there. But it is really irritating me and I'd like to fix it so any help is greatly appreciated :)
Thanks in advance.
UPDATE
Thank you for all your answers. The solution you have all given is to add .navbar-toggle {outline: 0;} or outline: none; or some variation of this. But this isn't working for me. In fact, all your snippets still have the same problem when I view them. Any idea why I'm not seeing the same result as you guys?
Just to be clear about the behaviour I am seeing, here is a screenshot of Dev_NIX's snippet running after I have just opened and closed the nav menu by clicking the button:
ANOTHER UPDATE
I've tried running this code snippet from another version of Safari on another Mac and there is no issue! So I guess it must just be some strange bug with my version of Safari (9.1). So the problem hasn't been solved but it seems to be unique to me so I'm not gonna worry about it any longer :)
Thanks again for all your answers!
Try setting the outline to none:
button.navbar-toggle{ outline:none; }
$(document).ready(function() {
$(".navbar-toggle").on("click focus", function() {
$(".navbar").toggleClass("open");
$(".navbar-toggle").toggleClass("open");
});
});
html {
font-family: "Raleway", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
font-weight: normal;
color: #888;
}
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
p {
margin: 0;
padding: 0;
font-weight: normal;
}
a {
text-decoration: none;
color: inherit;
}
button {
border: none;
-webkit-appearance: button;
cursor: pointer;
}
.navbar {
background: rgba(255, 236, 176, 0.97);
color: #555;
line-height: 50px;
display: none;
position: relative;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
z-index: 99;
}
.navbar-fixed {
position: fixed;
top: 0;
}
.navbar-brand {
display: inline-block;
padding: 0 15px;
}
.navbar-mobile {
background: #ffecb0;
position: fixed !important;
top: -100%;
display: block;
height: 275px;
width: 100%;
overflow-y: auto;
opacity: 0.0;
transition: .3s ease
}
.navbar.open {
opacity: 1.0;
top: 0;
}
.navbar-mobile .container {
padding: 0;
}
.navbar-toggle {
background: #ffecb0;
position: fixed;
display: block;
top: 10px;
right: 15px;
padding: 9px 10px;
border-radius: 5px;
z-index: 100;
background-image: none;
outline: none;
}
.navbar-toggle .icon-bar {
background-color: #555;
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
transition: .3s ease;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top: 4px;
}
.navbar-toggle.open .icon-bar:first-child {
transform: translate(0, 6px) rotate(225deg);
}
.navbar-toggle.open .icon-bar:nth-child(2) {
opacity: 0;
}
.navbar-toggle.open .icon-bar:last-child {
transform: translate(0, -6px) rotate(135deg);
}
nav ul {
list-style: none;
text-align: center;
}
nav a {
position: relative;
display: block;
font-size: 16px;
font-weight: 500;
}
nav li a:hover {
color: black;
background-color: #ffe389;
}
nav li a.active {
color: white;
background-color: #847d64;
}
.btn {} .navbar-button {
color: #fff;
display: inline-block;
border-radius: 5px;
font-size: 16px;
font-weight: 500;
letter-spacing: 1px;
text-align: center;
overflow: hidden;
transition: .3s;
background-color: #a48eff;
border-color: #8c6aff;
line-height: 1;
padding: 10px 10px;
margin: 0 15px;
}
.navbar-button:hover {
background-color: #b9a8ff;
color: white;
border-color: #ad94ff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="navbar-toggle" type="button" role="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<nav class="navbar navbar-mobile">
<div class="container">
Logo
<div class="navbar-items">
<ul>
<li>Home
</li>
<li>Link 2
</li>
<li>Link 3
</li>
<li><a class="button navbar-button" href="contact.html">Call to Action</a>
</li>
</ul>
</div>
</div>
</nav>
You can find this line in different browsers with different colors depending of your OS too, it is an outline.
As described by W3Schools:
An outline is a line that is drawn around elements (outside the
borders) to make the element "stand out".
The outline shorthand property sets all the outline properties in one
declaration.
The properties that can be set, are (in order): outline-color,
outline-style, outline-width.
If one of the values above are missing, e.g. "outline:solid #ff0000;",
the default value for the missing property will be inserted, if any.
I would select the item's class and set the outline to zero.
.navbar-toggle {
outline: 0;
}
And a working demo:
$(document).ready(function () {
$(".navbar-toggle").on("click", function () {
$(".navbar").toggleClass("open");
$(".navbar-toggle").toggleClass("open");
});
});
html {
font-family: "Raleway", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
font-weight: normal;
color: #888;
}
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
p {
margin: 0;
padding: 0;
font-weight: normal;
}
a {
text-decoration: none;
color: inherit;
}
button {
border: none;
-webkit-appearance: button;
cursor: pointer;
}
.navbar {
background: rgba(255, 236, 176, 0.97);
color: #555;
line-height: 50px;
display: none;
position: relative;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
z-index: 99;
}
.navbar-fixed {
position: fixed;
top: 0;
}
.navbar-brand {
display: inline-block;
padding: 0 15px;
}
.navbar-mobile {
background: #ffecb0;
position: fixed !important;
top: -100%;
display: block;
height: 275px;
width: 100%;
overflow-y: auto;
opacity: 0.0;
transition: .3s ease
}
.navbar.open {
opacity: 1.0;
top: 0;
}
.navbar-mobile .container {
padding: 0;
}
.navbar-toggle {
background: #ffecb0;
position: fixed;
display: block;
top: 10px;
left: 15px;
padding: 9px 10px;
border-radius: 5px;
z-index: 100;
background-image: none;
outline: 0; /* <<== line added */
}
.navbar-toggle .icon-bar {
background-color: #555;
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
transition: .3s ease;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top: 4px;
}
.navbar-toggle.open .icon-bar:first-child {
transform: translate(0, 6px) rotate(225deg);
}
.navbar-toggle.open .icon-bar:nth-child(2) {
opacity: 0;
}
.navbar-toggle.open .icon-bar:last-child {
transform: translate(0, -6px) rotate(135deg);
}
nav ul {
list-style: none;
text-align: center;
}
nav a {
position: relative;
display: block;
font-size: 16px;
font-weight: 500;
}
nav li a:hover {
color: black;
background-color: #ffe389;
}
nav li a.active {
color: white;
background-color: #847d64;
}
.btn {
}
.navbar-button {
color: #fff;
display: inline-block;
border-radius: 5px;
font-size: 16px;
font-weight: 500;
letter-spacing: 1px;
text-align: center;
overflow: hidden;
transition: .3s;
background-color: #a48eff;
border-color: #8c6aff;
line-height: 1;
padding: 10px 10px;
margin: 0 15px;
}
.navbar-button:hover {
background-color: #b9a8ff;
color: white;
border-color: #ad94ff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="navbar-toggle" type="button" role="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<nav class="navbar navbar-mobile">
<div class="container">
Logo
<div class="navbar-items">
<ul>
<li>Home</li>
<li>Link 2</li>
<li>Link 3</li>
<li><a class="button navbar-button" href="contact.html">Call to Action</a></li>
</ul>
</div>
</div>
</nav>
EDIT: As mentioned here and here, outline: none; and outline: 0; can give to you similar visual results, but I would go to outline: 0; definetly.
UPDATE: Your screenshot does not look at all like an outline. May you should restart your browser or even your computer/device? It really seems like an inspector bug to me...
This should do the trick. The focus pseudoclass is the key.
.navbar-toggle:focus {
outline: none;
}
Try below css.
* {
outline: none;
}