I am currently making a website for a heli-skiing business and I am having trouble with the drop down menu. For some reason, it doesn't align correctly. I have looked at similar posts on this website for the answer and it seems that setting the position for the parent element to relative and setting the child element's position to absolute is the most common answer; however this isn't working for me. It's probably because I am applying it to the wrong parent/child elements; but I have attempted a lot of different options and nothing seems to work. Below is my code (I ran into issues with jsfiddle and I am too frustrated from other projects to mess with fixing another issue). I also know that my css code is a mess and needs to be cleaned up a bit. Thank you for any help
HTML:
<header>
<a name="top"></a>
<div class="header">
<div class="nav-a">
<ul class="menu">
<li class="menu-item-2667">Trips
<ul class="drop-down">
<li class="drop-down-items">Alaska Trip</li>
<li class="drop-down-items">Chile Trip</li>
<li class="drop-down-items">Argentina Trip</li>
</ul>
</li>
<li class="menu-item-20">Gallery</li>
</ul>
</div>
<div class="nav-b">
<ul class="menu">
<li class="menu-item-126">About</li>
<li class="menu-item-127">Contact</li>
</ul>
</div>
</div>
</header>
CSS:
ul, menu, dir{
display: block;
list-style-type: disc;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
padding-inline-start: 40px;
}
ul, ol {
margin-left: 0;
}
ul, ol, dl {
font-size: 1em;
line-height: 1.6;
margin-bottom: 1.25em;
list-style-position: outside;
font-family: inherit;
}
li {
display: list-item;
text-align: -webkit-match-parent;
}
a {
color: red;
text-decoration: none;
line-height: inherit;
}
a:hover,
a:focus {
color: #e60000;
}
#media only screen and (min-width: 768px) {
header {
padding: 0 15px;
}
}
.header {
padding: 0px 0px 15px;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
margin-bottom: 0;
max-width: 60.875em;
}
.header:before,
.header:after {
content: " ";
display: table;
}
.header:after {
clear: both;
}
.header>.nav-a {
display: none;
position: relative;
padding-left: 0.9375em;
padding-right: 0.9375em;
margin: auto;
width: 100%;
float: left;
}
.header>.nav-b {
display: none;
position: relative;
padding-left: 0.9375em;
padding-right: 0.9375em;
margin: auto;
width: 100%;
float: right;
}
#media (min-width: 768px){
.header>.nav-a {
display: block;
position: relative;
padding-left: 0;
padding-right: 0;
margin: auto;
width: 50%;
right: auto;
left: auto;
float: left;
}
.header>.nav-b{
display: block;
position: relative;
padding-left: 0;
padding-right: 0;
margin: auto;
width: 50%;
right: auto;
left: auto;
float: right;
}
}
.menu {
display: block;
padding: 0;
*zoom: 1;
margin-top: 15px;
margin-bottom: 0;
margin-right: 0;
margin-left: 0;
}
.menu:before,
.menu:after {
content: " ";
display: table;
}
.menu:after {
clear: both;
}
.menu>li {
display: inline;
height: auto;
float: left;
padding: 0 0.625em 1.25em;
}
.menu>li {
width: 33.33333%;
padding: 0 0.625em 1.25em;
}
.menu>li:nth-of-type(n) {
clear: none;
}
.menu>li:nth-of-type(3n+1) {
clear: both;
}
#media only screen and (min-width: 768px) {
.menu {
margin-top: 30px;
}
}
#media only screen and (min-width: 1024px) {
.menu {
margin-top: 30px;
}
}
#media only screen and (min-width: 1230px) {
.menu {
margin-top: 30px;
}
}
.menu>li {
padding-bottom: 0;
}
.menu>li>a {
font-family: "Tungsten A", "Tungsten B";
font-weight: 400;
font-style: normal;
font-size: 24px;
text-align: center;
padding: 0 15px;
display: inline-block;
color: #525252;
border: 3px solid #f3f3f3;
text-transform: uppercase;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
#media only screen and (min-width: 768px) {
.menu>li>a {
font-size: 20px;
}
}
#media only screen and (min-width: 1024px) {
.menu>li>a {
font-size: 28px;
}
}
#media only screen and (min-width: 1230px) {
.menu>li>a {
font-size: 30px;
}
}
.menu>li>a.active {
color: #111;
}
.menu>li>a:hover {
border: 3px solid rgb(0, 0, 0);
color: #181818;
}
.drop-down-items {
display: none;
}
.menu .menu-item-2667:hover .drop-down .drop-down-items{
display: inline-block;
padding: 0;
width: auto;
left: 0;
}
.drop-down-items a {
font-family: "Tungsten A", "Tungsten B";
font-weight: 400;
font-style: normal;
font-size: 14px;
text-align: center;
display: inline-block;
color: #525252;
border: 3px solid #f3f3f3;
text-transform: uppercase;
margin-left: auto;
margin-right: auto;
width: auto;
margin: 0px;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.menu>li>ul>li>a:hover {
color: #181818;
}
It is because of the padding-inline-start in your css style, you can remove the style or add an inline style to the dropdown menu like below
<ul class="drop-down" style="padding-inline-start: 0;">
<li class="drop-down-items">Alaska Trip</li>
<li class="drop-down-items">Chile Trip</li>
<li class="drop-down-items">Argentina Trip</li>
</ul>
Related
I am using a a navbar template but I am having an issue where the navbar links still exist on the page and are clickable even when the navbar is "closed".
I was thinking of maybe changing the class with the script, modifying the existing one but I actually am not sure how to do that.
What is the best way to hide the links or get rid of them temporarily when the navbar is closed?
var $header_top = $('.header-top');
var $nav = $('nav');
$header_top.find('a').on('click', function() {
$(this).parent().toggleClass('open-menu');
});
a {
text-decoration: none;
color: white;
}
ul,
li {
list-style-type: none;
}
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.l-left {
float: left;
}
.l-right {
float: right;
}
.end {
margin-top: 30px;
font-size: 3em;
font-weight: bold;
opacity: 0;
-webkit-transform: translateY(300px);
transform: translateY(300px);
transition: opacity, -webkit-transform 1s;
transition: opacity, transform 1s;
transition: opacity, transform 1s, -webkit-transform 1s;
transition-delay: 1s;
}
.header-top {
background: white;
height: 70px;
padding: 0 10px;
position: fixed;
top: 0;
width: 100%;
min-width: 300px;
z-index: 12;
box-sizing: border-box;
}
h1 {
line-height: 70px;
height: 70px;
}
h1 a {
color: red;
padding: 0 10px;
font-family: "arial black";
font-size: 35px;
}
.first-letter {
color: red;
padding: 0px;
font-family: "arial black";
font-size: 45px;
}
.toggle-menu {
width: 50px;
height: 50px;
display: inline-block;
position: relative;
top: 10px;
}
.toggle-menu i {
position: absolute;
display: block;
height: 2px;
background: red;
width: 30px;
left: 10px;
transition: all .3s;
}
.toggle-menu i:nth-child(1) {
top: 16px;
}
.toggle-menu i:nth-child(2) {
top: 24px;
}
.toggle-menu i:nth-child(3) {
top: 32px;
}
.open-menu i:nth-child(1) {
top: 25px;
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg);
}
.open-menu i:nth-child(2) {
background: transparent;
}
.open-menu i:nth-child(3) {
top: 25px;
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg);
}
nav {
height: 0;
opacity: 0;
box-sizing: border-box;
background: rgba(0, 47, 77, .25);
position: fixed;
top: 70px;
width: 100%;
transition: all 1s;
}
.open-menu~nav {
opacity: 1;
padding: 80px 0;
z-index: 15;
height: calc(90vh - 70px);
}
nav ul {
padding: 0 10px;
display: flex;
}
nav li {
flex: 1;
}
nav li a {
font-size: 2em;
display: block;
padding: 30px;
text-align: center;
transition: background .3s;
}
nav li a {
background: #ff4b4b;
margin-left: 20px;
}
nav li a:hover {
background: #ADD8E6;
}
/*These 3 sections add the drop dwon menus in the headers*/
ul li ul.services-dropdown {
display: none;
z-index: 999;
width: 100%;
}
ul li:hover ul.services-dropdown {
display: inline-block;
/* Display the dropdown */
}
ul li ul.services-dropdown li {
display: block;
}
section {
text-align: center;
}
h2 {
font-size: 13px;
}
h2 a {
padding: 8 8 8 8px;
float: left;
color: white;
background-color: red;
font-family: 'Open Sans';
font-weight: bold;
}
h3 {
font-weight: bold;
font-size: 60px;
color: white;
}
#fp-nav ul li a span,
.fp-slidesNav ul li a span {
background: white;
width: 8px;
height: 8px;
margin: -4px 0 0 -4px;
}
#fp-nav ul li a.active span,
.fp-slidesNav ul li a.active span,
#fp-nav ul li:hover a.active span,
.fp-slidesNav ul li:hover a.active span {
width: 16px;
height: 16px;
margin: -8px 0 0 -8px;
background: transparent;
box-sizing: border-box;
border: 2px solid #212121;
}
#media (max-width: 700px) {
.edit-name {
display: none;
}
}
/*Removes the tel and email when window is narrow */
#media (max-width: 1230px) {
.narrow-hide {
display: none;
}
}
/*Edits the nav bar when window is narrow */
#media screen and (max-width: 767px) {
nav ul {
flex-direction: column;
}
nav li {
margin-top: 1px;
}
nav li a {
font-size: 1.5em;
}
.scroll-icon {
display: none;
}
#media screen and (max-width: 400px) {
html {
font-size: 50%;
}
.open-menu~nav {
padding: 20px 0;
}
nav li a {
padding: 3px;
}
}
<header>
<div class="header-top clearfix">
<a class="l-right toggle-menu" href="#">
<i></i>
<i></i>
<i></i>
</a>
</div>
<nav class="hide">
<ul id="menu">
<li>
Home
</li>
<li>
Services
<ul class="services-dropdown ">
<li>whats </li>
<li>Stuff</li>
<li>Things</li>
</ul>
</li>
<li>
News & Events
</li>
<li>
Contact Us
</li>
<li>
Data Protection
</li>
<li>
Data Protection
</li>
</ul>
</nav>
</header>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js "></script>
Codepen: https://codepen.io/Ribeye/pen/BajOoeb
Just add overflow: hidden to nav and it will be fixed;
nav {
overflow: hidden;
}
You've set height: 0 and opacity: 0, but the content still overflows and the only reason it's not visible is bacause of opacity: 0 property, that just makes it transparent so it's still clickable.
You should add pointer-events: none to .nav and pointer-events: auto to .open-menu ~ nav
auto
The element behaves as it would if the pointer-events property
were not specified. In SVG content, this value and the value
visiblePainted have the same effect.
none
The element is never the target of pointer events; however,
pointer events may target its descendant elements if those descendants
have pointer-events set to some other value. In these circumstances,
pointer events will trigger event listeners on this parent element as
appropriate on their way to/from the descendant during the event
capture/bubble phases.
Ref
var $header_top = $('.header-top');
var $nav = $('nav');
$header_top.find('a').on('click', function() {
$(this).parent().toggleClass('open-menu');
});
/* added */
nav {
pointer-events: none;
}
.open-menu~nav {
pointer-events: auto;
}
/*****/
a {
text-decoration: none;
color: white;
}
ul,
li {
list-style-type: none;
}
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.l-left {
float: left;
}
.l-right {
float: right;
}
.end {
margin-top: 30px;
font-size: 3em;
font-weight: bold;
opacity: 0;
-webkit-transform: translateY(300px);
transform: translateY(300px);
transition: opacity, -webkit-transform 1s;
transition: opacity, transform 1s;
transition: opacity, transform 1s, -webkit-transform 1s;
transition-delay: 1s;
}
.header-top {
background: white;
height: 70px;
padding: 0 10px;
position: fixed;
top: 0;
width: 100%;
min-width: 300px;
z-index: 12;
box-sizing: border-box;
}
h1 {
line-height: 70px;
height: 70px;
}
h1 a {
color: red;
padding: 0 10px;
font-family: "arial black";
font-size: 35px;
}
.first-letter {
color: red;
padding: 0px;
font-family: "arial black";
font-size: 45px;
}
.toggle-menu {
width: 50px;
height: 50px;
display: inline-block;
position: relative;
top: 10px;
}
.toggle-menu i {
position: absolute;
display: block;
height: 2px;
background: red;
width: 30px;
left: 10px;
transition: all .3s;
}
.toggle-menu i:nth-child(1) {
top: 16px;
}
.toggle-menu i:nth-child(2) {
top: 24px;
}
.toggle-menu i:nth-child(3) {
top: 32px;
}
.open-menu i:nth-child(1) {
top: 25px;
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg);
}
.open-menu i:nth-child(2) {
background: transparent;
}
.open-menu i:nth-child(3) {
top: 25px;
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg);
}
nav {
height: 0;
opacity: 0;
box-sizing: border-box;
background: rgba(0, 47, 77, .25);
position: fixed;
top: 70px;
width: 100%;
transition: all 1s;
}
.open-menu~nav {
opacity: 1;
padding: 80px 0;
z-index: 15;
height: calc(90vh - 70px);
}
nav ul {
padding: 0 10px;
display: flex;
}
nav li {
flex: 1;
}
nav li a {
font-size: 2em;
display: block;
padding: 30px;
text-align: center;
transition: background .3s;
}
nav li a {
background: #ff4b4b;
margin-left: 20px;
}
nav li a:hover {
background: #ADD8E6;
}
/*These 3 sections add the drop dwon menus in the headers*/
ul li ul.services-dropdown {
display: none;
z-index: 999;
width: 100%;
}
ul li:hover ul.services-dropdown {
display: inline-block;
/* Display the dropdown */
}
ul li ul.services-dropdown li {
display: block;
}
section {
text-align: center;
}
h2 {
font-size: 13px;
}
h2 a {
padding: 8 8 8 8px;
float: left;
color: white;
background-color: red;
font-family: 'Open Sans';
font-weight: bold;
}
h3 {
font-weight: bold;
font-size: 60px;
color: white;
}
#fp-nav ul li a span,
.fp-slidesNav ul li a span {
background: white;
width: 8px;
height: 8px;
margin: -4px 0 0 -4px;
}
#fp-nav ul li a.active span,
.fp-slidesNav ul li a.active span,
#fp-nav ul li:hover a.active span,
.fp-slidesNav ul li:hover a.active span {
width: 16px;
height: 16px;
margin: -8px 0 0 -8px;
background: transparent;
box-sizing: border-box;
border: 2px solid #212121;
}
#media (max-width: 700px) {
.edit-name {
display: none;
}
}
/*Removes the tel and email when window is narrow */
#media (max-width: 1230px) {
.narrow-hide {
display: none;
}
}
/*Edits the nav bar when window is narrow */
#media screen and (max-width: 767px) {
nav ul {
flex-direction: column;
}
nav li {
margin-top: 1px;
}
nav li a {
font-size: 1.5em;
}
.scroll-icon {
display: none;
}
#media screen and (max-width: 400px) {
html {
font-size: 50%;
}
.open-menu~nav {
padding: 20px 0;
}
nav li a {
padding: 3px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<header>
<div class="header-top clearfix">
<a class="l-right toggle-menu" href="#">
<i></i>
<i></i>
<i></i>
</a>
</div>
<nav class="hide">
<ul id="menu">
<li>
Home
</li>
<li>
Services
<ul class="services-dropdown ">
<li>whats </li>
<li>Stuff</li>
<li>Things</li>
</ul>
</li>
<li>
News & Events
</li>
<li>
Contact Us
</li>
<l>
Data Protection
</l>
<l>
Data Protection
</l>
</ul>
</nav>
</header>
You just need to set overflow: hidden property on the nav element
there is full code of my plugin > https://codepen.io/doodlemarks/pen/aFcly
in my code element #slider ul li have width bigger than 900px and it is not scaling smaller on device with smaller resolution.
can anyone help me how to improve it and make it responsible to scale ul li element on devices e.g. mobile?
html/css:
#import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600);
html {
border-top: 5px solid #fff;
background: #58DDAF;
color: #2a2a2a;
}
html, body {
margin: 0;
padding: 0;
font-family: 'Open Sans';
}
h1 {
color: #fff;
text-align: center;
font-weight: 300;
}
#slider {
position: relative;
overflow: hidden;
margin: 20px auto 0 auto;
border-radius: 4px;
}
#slider ul {
position: relative;
margin: 0;
padding: 0;
height: 200px;
list-style: none;
}
#slider ul li {
position: relative;
display: block;
float: left;
margin: 0;
padding: 0;
width: 500px;
height: 300px;
background: #ccc;
text-align: center;
line-height: 300px;
}
a.control_prev, a.control_next {
position: absolute;
top: 40%;
z-index: 999;
display: block;
padding: 4% 3%;
width: auto;
height: auto;
background: #2a2a2a;
color: #fff;
text-decoration: none;
font-weight: 600;
font-size: 18px;
opacity: 0.8;
cursor: pointer;
}
a.control_prev:hover, a.control_next:hover {
opacity: 1;
-webkit-transition: all 0.2s ease;
}
a.control_prev {
border-radius: 0 2px 2px 0;
}
a.control_next {
right: 0;
border-radius: 2px 0 0 2px;
}
.slider_option {
position: relative;
margin: 10px auto;
width: 160px;
font-size: 18px;
}
<h1>Incredibly Basic Slider</h1>
<div id="slider">
>
<
<ul>
<li>SLIDE 1</li>
<li style="background: #aaa;">SLIDE 2</li>
<li>SLIDE 3</li>
<li style="background: #aaa;">SLIDE 4</li>
</ul>
</div>
<div class="slider_option">
<input type="checkbox" id="checkbox">
<label for="checkbox">Autoplay Slider</label>
</div>
You can use #media CSS at-rule in your code just for example
<style>
/* First Example */
/* For desktop: */
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
#media only screen and (max-width: 768px) {
/* For mobile phones: */
[class*="col-"] {
width: 100%;
}
}
/* Second Example */
#media screen and (min-width: 900px) {
article {
padding: 1rem 3rem;
}
}
</style>
You can learn more about responsive web by these links
https://www.w3schools.com/css/css_rwd_intro.asp
https://developer.mozilla.org/en-US/docs/Web/CSS/#media
display:block; not applying on max-width: 320px.
Background changes to green, but <li> keeps displaying as float:
.parent-ul li {
display: block;
height: 32px;
width: 15.7%;
/* float: left;*/
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: royalblue;
font-family: monospace;
}
header {
position: relative;
top: 0px;
margin: 0 auto;
height: 38px;
width: 100%;
padding-top: 2px;
background: red;
}
.parent-ul {
position: relative;
list-style: none;
text-align: center;
margin-left: 16%;
}
.parent-ul li {
height: 32px;
width: 15.7%;
float: left;
}
.parent-ul li{
border-left: 1px solid silver;
}
#prod {
border-right: 1px solid silver;
}
.parent-ul a {
text-decoration: none;
color: white;
padding: 12px 38px;
font-size: 15px;
transition: color 1s, font-size .5s;
line-height: 32px;
}
/* 398px ================================= */
#media screen and (max-width: 320px) {
body {
background: green;
}
header {
position: relative;
top: 0px;
margin: 0 auto;
/* height: 38px;*/
width: 100%;
padding-top: 2px;
background: red;
}
.parent-ul {
position: relative;
list-style: none;
text-align: center;
margin-left: 16%;
}
.parent-ul li {
display: block;
height: 32px;
width: 15.7%;
/* float: left;*/
}
.parent-ul li{
border-left: 1px solid silver;
}
#prod {
border-right: 1px solid silver;
}
.parent-ul a {
text-decoration: none;
color: white;
padding: 12px 38px;
font-size: 15px;
transition: color 1s, font-size .5s;
line-height: 32px;
}
}
<body>
<header>
<ul class="parent-ul">
<li>Home</li>
<li>Services</li>
<li>Products</li>
<li>Contact</li>
<li id="prod">About Us</li>
</ul>
</header>
</body>
whenever you use float always clear it. In your case you used float in web but you haven't clear it at 320 media query, clear it using the float: none; clear: both;
I am working on a mobile responsive website.
I have the navigation menu with the fixed position.
Right after I close the nav-menus div I have an image that has to be right under it. The thing is that the image goes under the fixed div of the menu.
What is the solution for this?
I want the yellow banner to be fully visible under the nav bar. now it's just under + behind it.
This is an example of what I have :
HTML code:
<!DOCTYPE html>
<html >
<body style="height:100%;">
<div data-role="panel" id="menu" class="" style="padding: 45px 0; margin: 0; " >
<div class="ui-panel-inner">
// the main menu in the background
</div>
</div>
<div id="superDiv" style="background-color: white; -webkit-transition: width 2s; transition: width 2s; height: 130%; ">
<div class="main" style="height: 100%;">
<div class="sidebar">
// menu items
</div>
<div class="header_space"></div> // I used this but it's now working good with precentages..
<img src="banner.png" id="mob-banner"/> // this is the banner
<div class="dynamicPage">
// content of the page..
</div>
</div>
</div>
</body>
</html>
The CSS code:
/******************/
/*** MOBILE ******/
/****************/
.header_space{
display: none;
height: 5.1%;
}
#mob-menu-btn{
display: none;
}
.sub-menu{
display: none;
}
#mob-home-btn{
display: none;
}
#mob-logo{
display: none;
}
#mob-banner{
display: none;
}
.makeFixed{
position: fixed;
}
/*****************************************************************/
#media (max-width: 604px) {
.main{
width: 100%;
/*overflow: hidden;*/
overflow-x: hidden;
}
.sidebar{
float: initial;
width: 100%;
padding: 0;
position: fixed;
z-index: 100;
background-image: url('top_background.png');
text-decoration: none;
}
.header_space{
display: inherit;
height: 4.7%;
}
.sports{
/*display: none;*/
padding: 0 ;
background-color: #fff;
margin: 0;
width:100%;
}
.list{
width: 100%;
overflow: hidden;
overflow-y: auto;
top: -10%;
overflow: hidden;
overflow-y: auto;
height: 880%;
display: none;
}
.sports li{
list-style-image:none;
list-style-type: none;
border-bottom: 2px solid #eeeeee;
margin-bottom: 0px;
margin-left: 0px;
/*padding-top: 15px;
padding-bottom: 15px;*/
padding-left: 10px;
width:100%;
font-family: arial;
text-decoration: none;
overflow: hidden;
/*height: 27px;*/
z-index: 100;
}
.sports a li {
text-decoration: none;
}
.sports2{
display: none;
margin-bottom: 0;
overflow: hidden;
}
.sub-menu{
display: inherit;
float: left;
cursor: pointer;
width: 30px;
/*margin-right: 20px;*/
position: relative;
bottom: 7px;
z-index: 900;
position: relative;
top: 7px;
padding-right: 17px;
}
.sports2 li{
list-style-image:none;
list-style-type: none;
border-bottom: 0px solid #eeeeee;
margin-bottom: 0px;
margin-left: 0px;
/*padding-top: 15px;
padding-bottom: 15px;*/
padding-left: 0px;
width:100%;
font-family: "arial";
text-decoration: none;
overflow: hidden;
}
.sports2 div{
padding: 15px 0;
}
#mob-menu-btn{
float: right;
width: 10%;
display: inherit;
cursor: pointer;
margin-top: 0.8%;
}
#mob-home-btn{
display: inherit;
cursor: pointer;
margin-top: 0.8%;
width: 10%;
float: left;
}
#mob-logo{
display: inherit;
text-align: center;
margin: 0.2% auto;
width: 30%;
}
#mob-banner{
display: inherit;
}
.banner{
display: none;
}
.content{
width:100%;
background-color: white;
}
.logo{
padding-top: 1px;
}
#cat-header{
display: none;
}
.line{
display: none;
}
.table {
width: 100%;
}
#top-pages{
display: none;
}
.top-pages{
display: none;
}
.category-link{
float:left;
padding-top: 25px;
width: 510px;
padding: 15px 0;
}
.content h1 {
color:#031c3f;
font-size:24px;
text-align: left;
font-family: "UScoreRGK";
margin-left: 7px;
}
.content p {
margin-left: 10px;
margin-right: 10px;
}
#active_line{
margin-left: 10px;
margin-right: 10px;
}
#menu {
z-index: 0;
top: 0px;
position: absolute;
/*right: 0px!important;
left: auto!important;*/
}
#menu li {
list-style: none!important;
}
}
#media (min-width : 414px) and (max-width : 533px) {
.category-link{
width: 460px;
}
}
#media (min-width : 375px) and (max-width : 414px) {
.category-link {
width: 340px;
}
.wcmText ul, ol{
margin: 0 0 1em -2.5em;
}
.wcmText p{
margin-top: 0;
}
.wcmText h1, h2{
margin-top: 0;
margin-bottom: 0;
font-size: 110%;
}
}
#media (min-width : 360px) and (max-width : 375px) {
.category-link {
width: 282px;
}
.sidebar{
height: 38px;
}
}
#media (min-width : 320px) and (max-width : 360px) {
.wcmText ul, ol{
margin: 0 0 1em -2.5em;
}
.wcmText p{
margin-top: 0;
}
.wcmText h1, h2{
margin-top: 0;
margin-bottom: 0;
font-size: 110%;
}
}
#media (min-width : 240px) and (max-width : 320px) {
.sidebar{
background-image: url('top_background-320-2.png');
height: 52px;
}
#mob-menu-btn {
width: 7%;
margin-top: 4.8%;
margin-right: 4%;
}
#mob-home-btn {
width: 7%;
margin-top: 4.8%;
margin-left: 4%;
}
#mob-logo {
margin: 2% auto;
width: 45%;
}
.header_space {
height: 52px;
}
.list {
width: 99.5%;
overflow: hidden;
overflow-y: auto;
top: -9%;
overflow: hidden;
overflow-y: auto;
height: 803%;
}
.sports li {
width: 96%;
}
.content h1 {
color:#031c3f;
font-size:24px;
text-align: left;
font-family: "UScoreRGK";
margin-left: 7px;
}
.content p {
margin-left: 10px;
margin-right: 10px;
}
.category-link{
float:left;
padding-top: 25px;
width: 230px;
padding: 15px 0;
}
}
It looks like the only thing you are missing to make the ".header_space" work is to add
style="height: 100%;" to your HTML tag
<html style="height: 100%;">
or in your CSS
html { height:100% }
all your height properties, for example "height:100%" on the BODY tag, are not working.
although, i don't think your solution is an elegant one.
I would prefer to add
#media (max-width: 604px) {
/* lets say 50px is the height of your mobile menu */
#mob-banner { margin-top: 50px; }
}
to the the media query that handles your mobile views, instead of
<div class="header_space"></div>
I am working on improving my portfolio website (www.kikidesign.net) and am currently working on the footer. I'm trying to make it responsive in which the link (with the icon) will be able to stay the same but will be re-arranged in response to the browser window. For example, for desktop version, it will be in one line, but for tablet version, it will be two lines with two links in each row, and for mobile version, it will be like a list. However, I couldn't keep the icon and text in one place. When I move the browser window around, the icons keep popping out of their place. What should I do to fix it?
HTML
<div id="footercontent">
<ul class="ca-menu">
<li class="about2">
<a href="<?php echo get_option('home'); ?>/about" >
<span class="aboutimg"></span>About Me
</a>
</li>
<li class="contact2">
<a href="<?php echo get_option('home'); ?>/contact" >
<span class="contactimg"></span>Contact
</a>
</li>
<li class="download">
<a href="kikidesignResume.pdf">
<span class="downloadimg"></span>Resume
</a>
</li>
<li class="facebook">
<a href="https://www.facebook.com/kikidesignnet" >
<span class="facebookimg"></span>Facebook
</a>
</li>
</ul>
</div>
CSS
#footercontent {
position: relative;
padding-top: 15px;
margin-left: auto;
margin-right: auto;
width: 100%;
height: 100%;
min-height: 100px;
}
#footercontent .ca-menu {
width: 100%;
padding: 0;
list-style: none;
margin: 30px auto;
}
#footercontent .ca-menu li {
width: 23%;
height: 100%;
position: relative;
display: inline-block;
background: #2d1d53;
padding: 0 20px;
float: left;
}
#footercontent .ca-menu li a {
text-decoration: none;
text-align: left;
font-family: 'PrintClearlyRegular';
font-weight: normal;
font-style: normal;
font-size: 1.75em;
}
#footercontent .ca-menu li a:hover {
text-decoration: underline;
text-decoration-color: white;
-moz-text-decoration-color: white;
-webkit-text-decoration-color: white;
-o-text-decoration-color: white;
-ms-text-decoration-color: white;
}
.ca-menu li:hover .aboutimg, .ca-menu li:hover .contactimg, .ca-menu li:hover .downloadimg, .ca-menu li:hover .facebookimg {
color: #ffffff;
/**font-size: 30px;**/
opacity: 1;
}
.aboutimg {
display: inline-block;
width: 50px;
height: 60px;
text-align: center;
background: url(images/girlIcon2.png) no-repeat 0 0;
opacity: 0.3;
vertical-align: middle;
margin-top: -10px;
margin-right: 10px;
}
.ca-menu .about2 a {
color: #f9a145;
border: none;
text-decoration: none;
}
#contactimg {
padding: 15px 0 12px 0;
}
.contactimg {
display: inline-block;
width: 50px;
height: 60px;
background: url(images/contact.png) no-repeat 0 0;
margin-left: auto;
margin-right: auto;
vertical-align: middle;
margin-top: -8px;
opacity: 0.3;
margin-right: 10px;
}
.ca-menu .contact2 a {
color: #4595d1;
border: none;
text-decoration: none;
padding: 20px;
}
.downloadimg {
display: inline-block;
width: 50px;
height: 60px;
background: url(images/download.png) no-repeat 0 0;
margin-left: auto;
margin-right: auto;
vertical-align: middle;
margin-top: -8px;
opacity: 0.3;
margin-right: 10px;
}
.ca-menu .download a {
color: #f7e400;
border: none;
text-decoration: none;
padding: 20px;
}
.facebookimg {
display: inline-block;
width: 50px;
height: 60px;
background: url(images/facebook.png) no-repeat 0 0;
margin-left: auto;
margin-right: auto;
vertical-align: middle;
margin-top: -8px;
opacity: 0.3;
margin-right: 10px;
}
.ca-menu .facebook a {
color: #B0B0B0;
border: none;
text-decoration: none;
padding: 20px;
}
#footercontent .ca-menu {
width: 100%;
padding: 0;
list-style: none;
margin: 30px auto;
}
#footercontent .ca-menu li {
position: relative;
display: inline-block;
background: #2d1d53;
padding: 0 20px;
float: left;
}
I have made changes to those two part.
And for mobile:
#media (max-width: 480px) {
#footercontent .ca-menu li {
position: relative;
display: inline-block;
background: #2d1d53;
padding: 0 20px;
float: left;
width: 100%;
}
}
You can do same for other sizes also:
#media (min-width: 480px) and (max-width: 720px) {
#footercontent .ca-menu li {
position: relative;
display: inline-block;
background: #2d1d53;
padding: 0 20px;
float: left;
width: 40%;
}
}
DEMO