My drop-down content on the navbar overlaps my button and doesnt go under the button like Id wish. The drop-down content opens at the top of my button and I want it to open at the botton of the button on the navbar. Im pretty sure the problem lies with the CSS of the navbar but I haven't figured it out yet. Any help? thank you.
<ul class="nav-links">
<li><button class="btn About"><b>About</b></button>
</li>
<li><button class="btn Our Team"><b>Staff</b>
</button></li>
<li><button class="btn Apps & Games"><b>Games</b>
</button></li>
<li><button class="btn Contact"><b>Contact</b>
</button></li>
<div class="dropdown">
<li><button class="btn link" id="dropbtn"><a href="#"><b>Links</b>
</a>
<i class="fa fa-caret-down" aria-hidden="true"></i></li>
</button>
<div class="dropdown-content">
<a ref="#">Link 1</a>
<a ref="#">Link 2</a>
<a ref="#">Link 3</a>
<a ref="#">Link 4</a>
</div>
</div>
</ul>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
li {
float: left;
font-size: 0;
}
body {
margin: 0;
padding: 0;
background-image: url(.jpg);
background-size: cover;
}
p, p {
padding: 50px;
}
h1 {
-webkit-text-stroke: 3px black;
font-size: 50px;
}
nav {
height: 10vh;
background: red;
background-image: linear-gradient(to left, #e60000, #e60000, #e60000,
#e60000, black);
border-radius: 5px;
border-style: ridge;
overflow: hidden;
}
.btn {
border-radius: -10px;
background-color: inherit;
font-family: Arial, Helvetica, sans-serif;
color: white;
padding: 23px 33px;
cursor: pointer;
transition: 0.5s;
font-weight: 500;
letter-spacing: 1px;
text-transform: uppercase;
display: block;
}
.btn:hover {
background: black;
}
.nav-links {
display: flex;
list-style: none;
width: 50%;
height: 100%;
align-items: center;
margin-left: auto;
}
.nav-links li a {
color:white;
text-decoration: none;
font-size: 20px;
}
.landing {
height: 90vh;
display: flex;
justify-content: center;
align-items: center;
}
.landing h1 {
margin: 100px;
font-size: 50px;
color: white;
}
.dropdown {
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 17px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
float: right;
}
.dropdown-content {
display: none;
list-style: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #ddd;
color: black;
}
.dropdown:hover .dropdown-content {
display: block;
}
I'm a backend developer helping someone with an Angular webapplication and I ran into an issue when adding the fonts of our company, he uses material.
The red part is a mat-sidenav block and the blue is mat-sidenav-content the yellow part is some margin that suddenly is that big when I changed the fonts.
In devtools it looks like this:
so there is somewhere an element.style setting the margin but can't seem to find it in the code. Now the strange thing is if I dragged the tab out of chrome as a seperate window the issue is resolved but I don't think users will like doing that. Any clue why the margin changes and how I can resolve this permanently?
/* VAriables */
:root {
--color-accent: black; /* Fallback */
}
.u-category-test { --color-accent: rgba(67, 119, 64, 0.5); }
.u-category-qa { --color-accent: rgba(153, 100, 19, 0.5); }
.u-category-prod { --color-accent: rgba(216, 3, 3, 0.5); }
/* Nav */
.nav-header {
position: relative;
padding: 2rem;
}
.nav-title {
text-transform: uppercase;
font-weight: 300;
line-height: 1;
margin: 0;
}
.nav-title strong {
font-weight: 600;
}
.nav-header-icon {
position: absolute;
width: 36px;
height: 36px;
top: 1.5rem; /* magic */
right: 1.75rem; /* magic */
}
.nav-item {
padding: .5em 0.5em 0.5em 0;
}
.nav-icon {
width: 16px;
height: 16px;
vertical-align: top;
margin-right: .25rem;
}
.nav-category {
margin: .2em 0;
padding-left: 2rem;
font-size: 11px;
font-weight: normal;
text-transform: uppercase;
}
.nav-button {
display: block;
width: 100%;
padding: .2rem;
padding-left: calc(2rem + 16px + .5rem); /* padding + icon + magic */
line-height: 2;
text-align: left;
font: inherit;
font-size: 13px;
color: inherit;
border: none;
background-color: transparent;
cursor: default;
outline: none;
}
.nav-button:hover,
.nav-button:focus:not(.is-selected) {
background-color: hsla(0,0%,0%,.1);
}
.nav-button.is-selected {
background-color: var(--color-accent);
}
.nav-button.is-selected,
.nav-button.is-selected em {
color: #fff;
}
.nav-button.is-selected:focus {
opacity: .8;
}
.nav-button em {
font-style: normal;
font-weight: 600;
pointer-events: none; /* makes it invisible to clicks */
}
.nav-footer {
margin-top: 1rem;
padding: 2rem;
border-top: 1px solid var(--color-border);
text-align: center;
}
.nav-footer-version {
display: block;
width: 100%;
padding: 0;
margin-bottom: .75rem;
line-height: 2;
text-align: left;
font: inherit;
font-size: 13px;
color: inherit;
border: none;
background-color: transparent;
cursor: default;
outline: none;
text-align: center;
}
#button-download {
background-color: rgba(196, 196, 196, 0.5);
}
#button-download:hover {
background-color: rgba(150, 150, 150, 0.5);
}
.client-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #eee;
}
.main {
height: 100%;
}
<header class="nav-header">
<h1 class="nav-title">Clients</h1>
</header>
<div class="nav-item">
<h5 class="nav-category">
<span class="nav-icon flag-icon flag-icon-be"></span>
Client
</h5>
<button type="button" class="u-category-test nav-button" id="button-test" routerLink="test" routerLinkActive="is-selected">Dev</button>
<button type="button" class="u-category-qa nav-button" id="button-qa" routerLink="qa" routerLinkActive="is-selected">QA</button>
<button type="button" class="u-category-prod nav-button" id="button-prod" routerLink="prod" routerLinkActive="is-selected">Production</button>
</div>
.client-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #eee;
}
.main {
height: 100%;
}
#font-face {
font-family: 'Custom';
src: url('/assets/fonts/Custom.ttf') format('truetype');
}
* {
box-sizing: border-box;
}
html {
height: 100%;
font-family: 'Custom', 'BlinkMacSystemFont', 'Lucida Grande', 'Segoe UI', Ubuntu, Cantarell, sans-serif;
font-size: 14px;
line-height: 1.5;
overflow: hidden; /* Prevents rubber-band scrolling of the whole "page" */
color: var(--color);
background-color: #fff; /* To cover OSes with no default background color */
}
body {
margin: 0;
height: 100%;
display: flex;
}
h1,
h2,
h3 {
margin-top: 0;
line-height: 1.5;
}
h1 {
font-family: 'Custom';
font-size: 48px;
font-weight: normal;
}
h2 {
font-family: 'Custom';
font-weight: normal;
letter-spacing: -1px;
font-size: 16px;
}
h3, h4 {
font-family: 'Custom';
font-weight: normal;
font-size: 16px;
text-transform: uppercase;
}
h5{
font-family: 'Custom';
font-weight: normal;
font-size: 30px;
}
table {
width: 100%;
border-spacing: 0;
border: 1px solid hsla(0,0%,0%,.08);
border-width: 0 1px 1px 0;
}
th {
background-color: hsla(0,0%,50%,.06);
}
th,
td {
text-align: center;
border: 1px solid hsla(0,0%,0%,.08);
border-width: 1px 0 0 1px;
}
div.main{
padding: 30px;
button{
font-family: 'Custom';
margin: 10px;
}
button:hover{
background-color: transparent;
color:black;
}
}
<mat-sidenav-container class="client-container">
<mat-sidenav mode="side" opened><app-side-nav></app-side-nav></mat-sidenav>
<mat-sidenav-content>
<div class="main mat-app-background">
<router-outlet></router-outlet>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
What helped me was applying position: unset to mat-sidenav-container. This element by default has position: relative.
Interestingly I had this problem only with multiple sidenavs.
<mat-sidenav-container>
<mat-sidenav mode="side" position="start" opened>
<desktop-main-navigation></desktop-main-navigation>
</mat-sidenav>
<mat-sidenav-content>
<router-outlet></router-outlet>
</mat-sidenav-content>
<mat-sidenav mode="over" position="end">
Notifications
</mat-sidenav>
</mat-sidenav-container>
Your specific issue and fact it happened when adding fonts might has been explained here:
https://stackoverflow.com/a/56219106/2804285
* Skeleton V2.0.4
* Copyright 2014, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/29/2014
*/
/* Grid
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.container {
position: relative;
width: 100%;
max-width: 960px;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box; }
.column,
.columns {
width: 100%;
float: left;
box-sizing: border-box; }
/* For devices larger than 400px */
#media (min-width: 400px) {
.container {
width: 85%;
padding: 0; }
}
/* For devices larger than 550px */
#media (min-width: 550px) {
.container {
width: 90%; }
.column,
.columns {
margin-left: 4%; }
.column:first-child,
.columns:first-child {
margin-left: 0; }
.one.column,
.one.columns { width: 4.66666666667%; }
.two.columns { width: 13.3333333333%; }
.three.columns { width: 22%; }
.four.columns { width: 30.6666666667%; }
.five.columns { width: 39.3333333333%; }
.six.columns { width: 48%; }
.seven.columns { width: 56.6666666667%; }
.eight.columns { width: 65.3333333333%; }
.nine.columns { width: 74.0%; }
.ten.columns { width: 82.6666666667%; }
.eleven.columns { width: 91.3333333333%; }
.twelve.columns { width: 100%; margin-left: 0; }
.one-third.column { width: 30.6666666667%; }
.two-thirds.column { width: 65.3333333333%; }
.one-half.column { width: 48%; }
/* Offsets */
.offset-by-one.column,
.offset-by-one.columns { margin-left: 8.66666666667%; }
.offset-by-two.column,
.offset-by-two.columns { margin-left: 17.3333333333%; }
.offset-by-three.column,
.offset-by-three.columns { margin-left: 26%; }
.offset-by-four.column,
.offset-by-four.columns { margin-left: 34.6666666667%; }
.offset-by-five.column,
.offset-by-five.columns { margin-left: 43.3333333333%; }
.offset-by-six.column,
.offset-by-six.columns { margin-left: 52%; }
.offset-by-seven.column,
.offset-by-seven.columns { margin-left: 60.6666666667%; }
.offset-by-eight.column,
.offset-by-eight.columns { margin-left: 69.3333333333%; }
.offset-by-nine.column,
.offset-by-nine.columns { margin-left: 78.0%; }
.offset-by-ten.column,
.offset-by-ten.columns { margin-left: 86.6666666667%; }
.offset-by-eleven.column,
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
.offset-by-one-third.column,
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
.offset-by-two-thirds.column,
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
.offset-by-one-half.column,
.offset-by-one-half.columns { margin-left: 52%; }
}
/* Base Styles */
/* NOTE
html is set to 62.5% so that all the REM measurements throughout Skeleton
are based on 10px sizing. So basically 1.5rem = 15px :) */
html {
font-size: 62.5%; }
body {
font-size: 1.5rem;
line-height: 1.6;
font-weight: 400;
font-family: 'Roboto', sans-serif;
color: rgba(0,0,0,.7);
}
.header{
text-align: left;
}
.header img{
margin-top: 5%;
}
.header img a{
text-decoration: none;
}
.header p{
font-size: 9rem;
font-weight: 700;
line-height: 8.5rem;
font-family: 'roboto', monospace;
}
.home-feature-container{
padding: 2% 4% 6% 0;
}
.home-feature-container-onecolumn{
padding: 4% 0% 4% 0;
}
.home-feature-container img{
max-width: 100%;
}
.home-feature-container-onecolumn img{
max-width: 100%;
}
.header a{
color: #fed230;
font-weight: 700;
text-decoration: none;
}
.story-title{
text-transform:uppercase;
font-size: 4rem;
font-weight:400;
line-height: 1.2;
letter-spacing: 0rem;
}
.story-footer{
text-align: center;
border-top: 1px solid #e6e6e6;
margin-top: 10%;
}
.story-footer p{
font-size: 1.4rem;
color:#969696;
padding: 5% 0 0 0;
text-transform: uppercase;
}
#menu{
padding: 2% 0 2% 0;
}
#article{
margin: 8% 0 8% 0;
}
#home-entries{
margin: 6% 0 6% 0;
}
.navbar-list{
list-style: none;
margin-bottom: 0;
}
.navbar-item{
position: relative;
float: left;
margin-bottom:5%;
height: 40px;
}
.social{
text-decoration: underline;
}
.desc{
font-style: italic;
font-size: 1.1rem;
color:#B4B4B4;
}
.desc-story{
font-size: 1.2rem;
color: #B4B4B4;
padding: 0 0 5% 0;
font-family: 'roboto mono', monospace;
}
.desc-story a{
color:#B4B4B4;
text-decoration: underline;
}
.desc a{
color:#B4B4B4;
text-decoration: underline;
}
.writings-subtext{
font-size: 1.5rem;
margin-top: 0.4rem;
color:#969696;
margin-bottom: 2%;
font-family: 'roboto mono', monospace;
}
/* POTOGRAPHY related */
.cover-image{
margin: 0 auto;
padding: none;
}
.cover-image img{
width: 100%;
top:0; left:0;
}
.photo-set-title {
text-decoration: none;
color: #5A5A5A;
font-size: 1.7rem;
font-weight: 400;
font-family: 'roboto mono', monospace;
}
#photography-cover{
margin: 1% 2% 0% 0%;
text-align: center;
}
#photography-cover img{
max-width: 100%;
}
.photo-date{
font-size: 1.1rem;
color: #969696;
}
.photo-container {
margin-bottom: 2%;
margin-top: 8%;
}
.photo-container img{
max-width: 100%;
}
.photo-container:hover img{
}
.photo-story-container p{
text-align: center;
padding: 3% 0 3% 0;
}
.photo-breadcrumbs{
display: inline;
margin-bottom: 10%
}
.photo-breadcrumbs-one a{
color: #969696;
font-size: 1.3rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
.photo-breadcrumbs-two{
font-size: 2.5rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
/* VIDEO related */
video{
width:100%;
}
.video-container{
width: 100%;
margin: auto;
padding: 0 0 10% 0;
}
.video-container-400{
max-width: 400px;
margin: auto;
}
.video-container-360{
max-width: 360px;
margin: auto;
}
.video-container-682{
max-width: 682px;
margin: auto;
}
.video-container-644{
max-width: 682px;
margin: auto;
}
/* PORTOFLIO related */
.dates {
color: #969696;
font-size: 1.3rem;
font-weight: 300;
text-decoration: none;
font-family: 'roboto mono', monospace;
}
.photo-caption {
font-family: 'DINProMed', 'Roboto', sans-serif;
color: #969696;
font-size: 1.4rem;
font-weight: 300;
text-decoration: none;
}
.portfolio-project-container{
text-align: left;
padding: 4% 0 4% 0;
}
.portfolio-project-container p{
text-align: left;
padding: 3% 0 3% 0;
}
.portfolio-container{
margin-bottom: 20%;
}
.portfolio-big-container{
margin-bottom: 10%;
}
.portfolio-big-container img{
max-width: 100%;
display: block;
margin-bottom: 20px;
}
.portfolio-container img{
max-width: 100%;
display: block;
margin-bottom: 20px;
}
.portfolio-set-title {
text-decoration: none;
color: #5A5A5A;
font-size: 1.7rem;
font-weight:300;
font-family: 'roboto mono', monospace;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
}
h1 { font-weight:300; line-height: 1.2; color: #000; font-family: 'Roboto Mono', monospace; padding-bottom: 30px; margin-top:4%; text-transform: uppercase;}
h2 { line-height: 1.25; margin-bottom: 2rem; margin-top: 2rem; font-weight: 300; color:#333335; letter-spacing: 0.04rem; font-family: 'Roboto Mono', monospace; }
h3 { font-size: 2.5rem; line-height: 1.25; margin-bottom: 0rem; margin-top: 2%; font-weight: 400;font-family: 'Roboto Mono', monospace; }
h4 { font-weight:400; line-height: 1.2; letter-spacing: 0rem; }
h5 { font-size: 1.4rem; line-height: 1.5; padding: 2% 0 0% 0; color: #969696; margin-bottom: .2rem; font-weight:500; letter-spacing: 0.1rem;}
h6 { font-family: 'Open Sans', serif; text-transform:uppercase; font-size: 1.5rem; font-weight:600; line-height: 1.2; letter-spacing: 0rem;}
/* phone */
#media (max-width: 550px) {
.header p{
font-size: 6rem;
font-weight: 700;
line-height: 6rem;
font-family: 'roboto', monospace;
}
}
p {
margin-top: 0;
padding-right:0%;
line-height: 3rem}
p a{
/* text-decoration: underline; */
color: #2963ff;
}
/* Links */
a {
text-decoration: none;
color: #969696;
cursor: pointer;
}
/* Forms */
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea,
select {
height: 38px;
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
background-color: #fff;
border: 1px solid #D1D1D1;
border-radius: 4px;
box-shadow: none;
box-sizing: border-box; }
/* Removes awkward default styles on some inputs for iOS */
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none; }
textarea {
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px; }
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
border: 1px solid #33C3F0;
outline: 0; }
label,
legend {
display: block;
margin-bottom: .5rem;
font-weight: 600; }
fieldset {
padding: 0;
border-width: 0; }
input[type="checkbox"],
input[type="radio"] {
display: inline; }
label > .label-body {
display: inline-block;
margin-left: .5rem;
font-weight: normal; }
/* Lists */
ul {
list-style: circle inside; }
ol {
list-style: decimal inside; }
ol, ul {
padding-left: 0;
margin-top: 0; }
ul ul,
ul ol,
ol ol,
ol ul {
margin: 1.5rem 0 1.5rem 3rem;
font-size: 90%; }
li {
padding-left: 1rem;
margin-bottom: 1rem; }
/* Code */
code {
padding: .2rem .5rem;
margin: 0 .2rem;
font-size: 90%;
white-space: nowrap;
background: #F1F1F1;
border: 1px solid #E1E1E1;
border-radius: 4px; }
pre > code {
display: block;
padding: 1rem 1.5rem;
white-space: pre; }
/* Tables */
th,
td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #E1E1E1; }
th:first-child,
td:first-child {
padding-left: 0; }
th:last-child,
td:last-child {
padding-right: 0; }
/* Spacing */
button,
.button {
margin-bottom: 1rem; }
input,
textarea,
select,
fieldset {
margin-bottom: 1.5rem; }
pre,
blockquote,
dl,
figure,
table,
p,
ul,
ol,
form {
margin-bottom: 2.5rem; }
/* Utilities */
.u-full-width {
width: 100%;
box-sizing: border-box; }
.u-max-full-width {
max-width: 100%;
box-sizing: border-box; }
.u-pull-right {
float: right; }
.u-pull-left {
float: left; }
/* Misc */
hr {
margin-top: 3rem;
margin-bottom: 3.5rem;
border-width: 0;
border-top: 1px solid #E1E1E1; }
/* Clearing */
/* Self Clearing Goodness */
.container:after,
.row:after,
.u-cf {
content: "";
display: table;
clear: both; }
/* Media Queries */
/*
Note: The best way to structure the use of media queries is to create the queries
near the relevant code. For example, if you wanted to change the styles for buttons
on small devices, paste the mobile query code up in the buttons section and style it
there.
*/
/* Larger than mobile */
#media (min-width: 400px) {}
/* Larger than phablet (also point when grid becomes active) */
#media (min-width: 550px) {}
/* Larger than tablet */
#media (min-width: 750px) {}
/* Larger than desktop */
#media (min-width: 1000px) {}
/* Larger than Desktop HD */
#media (min-width: 1200px) {}
/* MORE CSS */
.value-prop {
margin-top: 1rem; }
.value-props {
margin-top: 4rem;
margin-bottom: 4rem; }
.docs-section {
padding: 4rem 0;
margin-bottom: 0;}
.value-img {
display: block;
text-align: center;
margin: 2.5rem auto 0; }
.example-grid .column,
.example-grid .columns {
background: #EEE;
text-align: center;
border-radius: 4px;
font-size: 1rem;
text-transform: uppercase;
height: 30px;
line-height: 30px;
margin-bottom: .75rem;
font-weight: 600;
letter-spacing: .1rem; }
.example {
position: relative;
margin-top: 4rem; }
.example-screenshot-wrapper {
border-radius: 0px;
display: block;
position: relative;
overflow: hidden;
height: 250px;
}
.example-screenshot-wrapper:hover {
box-shadow: 0, 0;
}
.example-screenshot {
width: 100%;
height: auto; }
.navbar {
display: none; }
/* Larger than phone */
#media (min-width: 550px) {
.value-props {
margin-top: 9rem;
margin-bottom: 7rem; }
.value-img {
margin-bottom: 1rem; }
.example-grid .column,
.example-grid .columns {
margin-bottom: 1.5rem; }
.docs-section {
padding: 0rem 0; }
.example-send-yourself-copy {
float: right;
margin-top: 12px; }
.example-screenshot-wrapper {
position: absolute;
width: 48%;
height: 100%;
left: 0;
max-height: none; }
}
/* ----------- BUTTONS ----------- */
/* NAVIGATION BAR */
.navbar-link {
font-family: 'DINProBold', 'Roboto', sans-serif;
color: #969696;
margin-right: 35px;
font-size: 1.3rem;
text-transform: uppercase;
letter-spacing: 0.2rem;
border: none;
white-space: nowrap;
background-color: #FFF;
padding-bottom: 5px;
border-radius: 0px;
padding-left: 0;
padding-right: 0;
cursor: pointer;
border-bottom: 5px solid #FFF;
transition: color .20s ease-in;
-moz-transition: color .20s ease-in;
-webkit-transition: color .20s ease-in;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
.navbar-link:hover {
color:#333333;
border-bottom: 5px solid #333333;
}
#active {
color: #333333;
border-bottom: 5px solid #333333;
}
/* SEE MORE */
.button {
font-family: 'DINProBold', 'Roboto', sans-serif;
color: #969696;
margin-right: 35px;
font-size: 1.3rem;
text-transform: uppercase;
letter-spacing: 0.2rem;
white-space: nowrap;
background-color: #FFF;
padding-bottom: 5px;
border-radius: 0px;
padding-left: 0;
padding-right: 0;
cursor: pointer;
border-bottom: 5px solid #FFF;
transition: color .20s ease-in;
-moz-transition: color .20s ease-in;
-webkit-transition: color .20s ease-in;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
.button:hover {
color:#333333;
border-bottom: 5px solid #333333;
}
#homebtn {
margin-right: 0px;
}
#main-button {
color: #fed230;
}
#main-button:hover {
border-bottom: 5px solid #fed230;
}
#fires-button {
color: #6AABC8;
}
#massive-button {
color: #0099F7;
}
#massive-button:hover {
border-bottom: 5px solid #0099F7;
}
#processing-button {
color: #D22A88;
}
#processing-button:hover {
border-bottom: 5px solid #D22A88;
}
#volume-UI-button {
color: #FFB2AD;
}
#volume-UI-button:hover {
border-bottom: 5px solid #FFB2AD;
}
#accessibility-button {
color: #02b875;
}
#accessibility-button:hover {
border-bottom: 5px solid #02b875;
}
.contact-link {
color: #969696;
cursor: pointer;
}
.contact-link:hover {
color: #333333;
cursor: pointer;
}
.contact-link-dribble {
color: #969696;
cursor: pointer;
}
.contact-link-dribble:hover {
color: #ea4c89;
cursor: pointer;
}
.contact-link-linkedin {
color: #969696;
cursor: pointer;
}
.contact-link-linkedin:hover {
color: #0077B5;
cursor: pointer;
}
#clothed-button {
color: #DD5837;
}
#clothed-button:hover {
border-bottom: 5px solid #DD5837;
}
#sign-button {
color: #0084FF;
}
#sign-button:hover {
border-bottom: 5px solid #0084FF;
}
#cablecar-button {
color: #EF6967;
}
#cablecar-button:hover {
border-bottom: 5px solid #EF6967;
}
/* ----------- LINKS ----------- */
#link {
color: #2963ff;
font-family: 'DINProBold', 'Roboto', sans-serif;
border-bottom: 3px solid #FFF;
transition: border-bottom .20s ease-in;
-moz-transition: border-bottom .20s ease-in;
-webkit-transition: border-bottom .20s ease-in;
}
#link:hover {
border-bottom: 3px solid #2963ff;
}
.centered {
display: block;
margin-left: auto;
margin-right: auto;
}
.center {
text-align: center !important;
}
#option-back:hover {
color: #333333;
cursor: pointer;
}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title> 🙋 Megan Mitchell's Portfolio</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#000000">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-121696572-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-121696572-1');
</script>
<!-- End Google Analytics -->
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500" rel="stylesheet">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Javascript
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script type="text/javascript" src="javascript/code.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="http://perceptioncube.com/M_Port/images/favicon.png">
</head>
<body>
<!-- On load fade in page -->
<script>
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(150);
$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(100, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
});
</script>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container">
<!-- logo -->
<div class="onecolumn" style="margin-top: 4%; margin-bottom:2%;">
<a href="index.html"> <img border="0" alt="Megan Mitchell Portfolio" src="images/megan_mitchell_dark.png" width="200" height="57">
</div>
<!-- end logo-->
<section class="header">
<div class="row" id="menu">
<div class="onecolumn" style="margin-top: 2%; margin-bottom:10%;">
<ul class="navbar-list"">
<li class="navbar-item"><a class="transition, navbar-link" id="active" href="index.html">Work</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href="contact.html">Contact</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href="illustrations.html">Illustrations</a></li>
<li class="navbar-item"><a class="transition, navbar-link" href=" https://thenounproject.com/megan.mitchell/" target="blank">Icons</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="onecolumn">
<p id="DINBold">Interactive Art Director & designer, currently at Apple. </p>
</div>
</div>
</section>
<div class="docs-section examples" id="home-entries">
<a name="apple"></a>
<!-- Apple 1 -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="apple_pass.html"> <img class="example-screenshot" src="images/landing/apple_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<h2 class="example-header"><span id="heading">Various Projects </span><span id="heading2">for Apple</span></h2>
<p><span class="dates" id="subheading">Nov 2014 · Present</span></p>
<p class="example-description">A variety of interactive projects for Apple since 2014 ranging from marketing websites to application design.</p>
<a class="button" id="main-button" href="apple_pass.html">See more</a>
<br>
<br>
</div>
</div>
</div>
<a name="ocho"></a>
<!-- ocho -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="ocho.html"> <img class="example-screenshot" src="images/landing/ocho_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<br>
<h2 class="example-header"><span id="heading">Product Design </span><span id="heading2">for Ocho</span></h2>
<p><span class="dates" id="subheading">Produced for Ocho</span></p>
<p class="example-description">Lead designer halfway through the project to assist with look and feel, design needs, on-boarding, UI and UX.</p>
<a class="button" id="main-button" href="ocho.html">See more</a>
<br>
<br>
<br>
</div>
</div>
</div>
<a name="chaos"></a>
<!-- State Farm Chaos -->
<div class="home-feature-container">
<div class="row example">
<a class="example-screenshot-wrapper" id="google-img" href="statechaos.html"> <img class="example-screenshot" src="images/landing/chaos_landing.jpg"> </a>
<div class="one-half offset-by-one-half column">
<br>
<h2 class="example-header"><span id="heading">App Design </span><span id="heading2">for Statefarm</span></h2>
<p><span class="dates" id="subheading">Produced at DDB</span></p>
<p class="example-description">Application concept and design for State of Chaos application that launches from an iAd.</p>
<a class="button" id="main-button" href="chaos.html">See more</a>
<br>
<br>
</div>
</div>
</div>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>
I'm not sure how I did this, but after cleaning my cache I realized that my site that I'm working on has lost the containers somehow. Reverting to older code hasn't helped fix the issue so I'm not sure where to start fixing this.
The site looks ok in safari, but is broken in Firefox or chrome. Any support for a coding novice would be really appreciated.
http://perceptioncube.com/M_Port/index.html
Currently all of the content is going edge to edge on the browser window, and but is could be centered within a 980px container. This has resulted in all content to be uncentered in a containing on all pages. Additionally I'm images throughout the site had a max width to them, but now they continue to grow as I increase the size of the browser.
EDIT: Actual answer: You are missing a /* as the first line of your CSS to start the block comment. The broken block comment is breaking the rules below it.
Looks to me like the CSS in your media queries are overriding the default styles, so on any device larger than 400px it will not apply the max-width: 960px; rule you are looking for. This is the problem code:
/* For devices larger than 400px */
#media (min-width: 400px) {
.container {
width: 85%;
padding: 0;
}
}
/* For devices larger than 550px */
#media (min-width: 550px) {
.container {
width: 90%;
}
}
You can see this by inspecting the element in Chrome dev tools:
Hello I'm really new in this web programming, just learned a few days ago, and try to make responsive navbar of mine. And I found tutorial on w3school, I followed it, and change some code, but it didnt work as intended. The menu succeed to collapse on desired width, but the hamburger menu doesnt show up. I think I already change and match it with my classes, but I dont know what else is wrong.
Here is what I have tried so far:
.navSection {
width: 100%;
display: inline-table;
line-height: 30px;
background: #1c948a;
z-index: 3;
box-shadow: 0px 3px 5px 1px rgba(0, 0, 0, .3);
}
.navMenu .icon{
display: none;
}
#media screen and (max-width: 700px) {
.navMenu ul li:not(:first-child) {display: none;}
.navMenu ul li.icon {
float: right;
display: block;
}
}
#media screen and (max-width: 700px) {
.navMenu.responsive {position: relative;}
.navMenu.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
.navMenu.responsive ul li {
float: none;
display: block;
text-align: left;
}
}
.navSectionWrapper {
width: 90%;
margin: auto;
}
.homelink {
text-decoration: none;
}
.navlogo {
width: 30%;
height: 70px;
float: left;
}
.logo {
display: inline-block;
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
color: #2C3E50;
position: absolute;
}
.logoimg {
height: 70px;
float: left;
}
.logotext {
font-weight: 600;
float: right;
line-height: 70px;
}
.logotext>span {
color: white;
text-shadow: 2px 2px 2px #33425B;
}
.navMenu {
float: right;
text-align: center;
overflow: hidden;
}
.navMenu>ul {
list-style: none;
}
.navMenu>ul>li {
display: inline-block;
line-height: 70px;
}
.navMenu>ul>li>a>span {
color: white;
font-weight: 700;
font-size: 17px
}
.navMenu>ul>li>a {
text-decoration: none;
color: #2C3E50;
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
font-weight: 600;
margin: 10px
}
.navMenu>ul>li>a:hover {
color: snow;
}
<div class="navSection">
<div class="navSectionWrapper">
<div class="navlogo">
<a href="#" class="homelink">
<div class="logo">
<img src="img/logo.png" class="logoimg">
<h2 class="logotext">Let's<span>Go</span></h2>
</div>
</a>
</div>
<div class="navMenu" id="mynavMenu">
<ul>
<li>Home</li>
<li>Features</li>
<li>About</li>
<li>+<span>Download</span></li>
<li>☰</li>
</ul>
</div>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("mynavMenu");
if (x.className === "navMenu") {
x.className += " responsive";
} else {
x.className = "navMenu";
}
}
</script>
ThankYou
Your HTML uses a.icon but you're targeting in CSS with li.icon. Moved the class="icon" to the li instead of the a and modified the CSS for .icon a bit. You were hiding :not(:first-child()) in the responsive view, and you either want to use :not(:last-child) since .icon is the :last-child or just use :not(.icon) there instead.
.navSection {
width: 100%;
display: inline-table;
line-height: 30px;
background: #1c948a;
z-index: 3;
box-shadow: 0px 3px 5px 1px rgba(0, 0, 0, .3);
}
.navMenu .icon{
display: none;
float: right;
}
#media screen and (max-width: 700px) {
.navMenu ul li:not(.icon) {display: none;}
.navMenu ul li.icon {
display: block;
}
}
#media screen and (max-width: 700px) {
.navMenu.responsive {position: relative;}
.navMenu.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
.navMenu.responsive ul li {
float: none;
display: block;
text-align: left;
}
}
.navSectionWrapper {
width: 90%;
margin: auto;
}
.homelink {
text-decoration: none;
}
.navlogo {
width: 30%;
height: 70px;
float: left;
}
.logo {
display: inline-block;
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
color: #2C3E50;
position: absolute;
}
.logoimg {
height: 70px;
float: left;
}
.logotext {
font-weight: 600;
float: right;
line-height: 70px;
}
.logotext>span {
color: white;
text-shadow: 2px 2px 2px #33425B;
}
.navMenu {
float: right;
text-align: center;
overflow: hidden;
}
.navMenu>ul {
list-style: none;
}
.navMenu>ul>li {
display: inline-block;
line-height: 70px;
}
.navMenu>ul>li>a>span {
color: white;
font-weight: 700;
font-size: 17px
}
.navMenu>ul>li>a {
text-decoration: none;
color: #2C3E50;
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
font-weight: 600;
margin: 10px
}
.navMenu>ul>li>a:hover {
color: snow;
}
<div class="navSection">
<div class="navSectionWrapper">
<div class="navlogo">
<a href="#" class="homelink">
<div class="logo">
<img src="img/logo.png" class="logoimg">
<h2 class="logotext">Let's<span>Go</span></h2>
</div>
</a>
</div>
<div class="navMenu" id="mynavMenu">
<ul>
<li>Home</li>
<li>Features</li>
<li>About</li>
<li>+<span>Download</span></li>
<li class="icon">☰</li>
</ul>
</div>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("mynavMenu");
if (x.className === "navMenu") {
x.className += " responsive";
} else {
x.className = "navMenu";
}
}
</script>
I'm designing a tv show page for my web design class I'm taking.
I added tabs to my web page to be used as top menu following a tutorial, but now I'm not sure how to center the tabs even using the center tag.
body {
font: 0.8em arial, helvetica, sans-serif;
}
#header ul {
list-style: none;
padding: 0;
margin: 0;
}
#header li {
float: right;
border: 1px solid #bbb;
border-bottom-width: 0;
margin: 0;
padding: 0;
}
#header a {
text-decoration: none;
display: block;
background: #eee;
padding: 0.24em 1em;
color: #00c;
width: 8em;
text-align: center;
}
#header a:hover {
background: #ddf;
}
#header #selected {
border-color: black;
}
#header #selected a {
position: relative;
top: 1px;
background: white;
color: black;
font-weight: bold;
}
#content {
border: 1px solid black;
clear: both;
padding: 0 1em;
}
h1 {
margin: 0;
padding: 0 0 1em 0;
}
<div id="header">
<center>
<ul>
<li style="font-family: DFKai-SB;">Home
</li>
<li style="font-family: DFKai-SB;">Shows
</li>
<li style="font-family: DFKai-SB;">Classic
</li>
<li style="font-family: DFKai-SB;">More
</li>
</ul>
</center>
</div>
<div id="content">
</div>
add this div with class .centeer to your tabs instead of <center> :
.centeer {
display: table;
margin: 0px auto 0px auto;
}
Live Demo
The float has more priority so that's why your content floats to one side instead of align. In your css at li elements use some inline variant to avoid stacking.
body {
font: 0.8em arial, helvetica, sans-serif;
}
#header ul {
list-style: none;
padding: 0;
margin: 0;
}
#header li {
display: inline-flex;
border: 1px solid #bbb;
border-bottom-width: 0;
margin: 0;
padding: 0;
}
#header a {
text-decoration: none;
background: #eee;
padding: 0.24em 1em;
color: #00c;
width: 8em;
text-align: center;
}
#header a:hover {
background: #ddf;
}
#header #selected {
border-color: black;
}
#header #selected a {
position: relative;
top: 1px;
background: white;
color: black;
font-weight: bold;
}
#content {
border: 1px solid black;
clear: both;
padding: 0 1em;
}
h1 {
margin: 0;
padding: 0 0 1em 0;
}
<div id="header">
<center>
<ul>
<li style="font-family: DFKai-SB;">Home
</li>
<li style="font-family: DFKai-SB;">Shows
</li>
<li style="font-family: DFKai-SB;">Classic
</li>
<li style="font-family: DFKai-SB;">More
</li>
</ul>
</center>
</div>
<div id="content">
</div>