I'm fairly new to html and css and I have completed the css styling and html for a site and have started working on the mobile version. However I am having trouble displaying the navigation bar as I am switching from horizontal to vertical, I would prefer not to change the html and just focus on a fix in css. Currently it is only displaying the last item of the list and suspect they might be stacking on top of each other but I am unsure. Please help.
the html for this part is
<nav class="topnav">
<ul>
<li>Home </li>
<li>Pendants</li>
<li>Lamp</li>
<li>Wall</li>
<li>Outdoor</li>
<li>Sale</li>
</ul>
</nav>
And the css is
.topnav {
position: relative;
width: 100vw;
height: 40vh;
top: 1vh;
background-color: #072F54;
color: white;
display: block;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
z-index: 9;
}
.topnav a {
position: absolute;
width: 100vw;
background-color: #072F54;
color: white;
text-align: left;
font-size: 1.5em;
padding: 1.5vh 1.5vh;
text-decoration: none;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
border-top: 0.3vw solid;
border-bottom: 0.3vw solid;
display: block;
z-index: 1;
}
.topnav a:hover {
color: #FBC108;
transition: 0.5s;
}
.topnav ul {
width: 100vw;
list-style-type: none;
margin: 0;
padding: 0;
padding-top: 3vh;
}
.topnav ul li {
width: 100vw;
display: block;
margin-top: 3.3vh;
}
[1]: https://i.stack.imgur.com/L7BNk.png
the problem is with position: absolute; of .topnav a
try this code. replace this with your CSS, also I comment out my every changes.
.topnav {
position: relative;
width: 100vw;
/*height: 40vh;*/
height: auto;
top: 1vh;
background-color: #072F54;
color: white;
display: block;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
z-index: 9;
}
.topnav a {
/*position: absolute;*/
width: 100vw;
background-color: #072F54;
color: white;
text-align: left;
font-size: 1.5em;
padding: 1.5vh 1.5vh;
text-decoration: none;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
border-top: 0.3vw solid;
border-bottom: 0.3vw solid;
display: block;
z-index: 1;
}
.topnav a:hover {
color: #FBC108;
transition: 0.5s;
}
.topnav ul {
width: 100vw;
list-style-type: none;
margin: 0;
padding: 0;
padding-top: 3vh;
}
.topnav ul li {
width: 100vw;
display: block;
margin-top: 3.3vh;
}
Related
Hey all have this menu which i wish to have toggle on click X and again back to hamburger style.
could someone help me out here? I just have no clue how that is achieved. sharing my menu codes here. hope some expert could help me out.
here are my menu codes
$(document).ready(function() {
$('#menulink').click(function(event) {
event.preventDefault();
if($('.navigation-wrapper').hasClass('show-menu')) {
$('.navigation-wrapper').removeClass('show-menu');
$('.navigation').hide();
$('.navigation li').removeClass('small-padding');
} else {
$('.navigation-wrapper').addClass('show-menu');
$('.navigation').fadeIn();
$('.navigation li').addClass('small-padding');
}
});
});
.hamburger-wrapper {
padding: 0;
background: #000;
position: fixed;
top: 40px;
left:90px;
width: 50px;
z-index: 999;
}
.inner-hamburger-wrapper {
background: #ca1404;
width: 100%;
padding: 8px 0;
}
.hamburger {
width: 50%;
height: 3px;
margin: 4px auto;
background: #fff;
border-radius: 2px;
}
.menu-title {
position: absolute;
top: 10px;
right: 0;
width: 50%;
}
.menu-title p {
color: #fff;
font-size: 18px;
line-height: 22px;
text-align: center;
}
.navigation-wrapper {
background: linear-gradient(180deg, #C7100C 0%, #3F5EFB 100%);
padding: 40px 0 0 0;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 900;
display: none;
}
.navigation {
padding: 50px 5% 0 5%;
display: none;
}
.show-menu {
display: block;
}
.navigation li {
list-style: none;
margin: 50px 0;
transition: all ease .6s;
} .navigation li.small-padding {
margin: 0;
}
.navigation li a {
display: block;
padding: 10px 0 10px 1%;
color: #fff !important;
text-decoration: none;
font-size: 150%;
letter-spacing: .1em;
border-left: 3px solid #000;
-moz-transition: all ease .3s;
-webkit-transition: all ease .3s;
-ms-transition: all ease .3s;
-o-transition: all ease .3s;
transition: all ease .3s;
}
.navigation li a:hover {
color: #fff;
padding-left: 2%;
border-left: 3px solid #eee;
}
#media (min-width: 320px) and (max-width: 768px) {
.hamburger-wrapper {
padding: 0;
background: #000;
position: fixed;
top: 30px;
left:5px;
width: 50px;
z-index: 999;
}
.navigation li a {
display: block;
padding: 10px 0 10px 1%;
color: #bbb;
text-decoration: none;
font-size: 90%;
letter-spacing: .1em;
border-left: 3px solid #000;
-moz-transition: all ease .3s;
-webkit-transition: all ease .3s;
-ms-transition: all ease .3s;
-o-transition: all ease .3s;
transition: all ease .3s;
border-bottom: 1px solid rgba(255, 255,
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<a id="menulink" href="#">
<div class="hamburger-wrapper">
<div class="inner-hamburger-wrapper">
<div class="hamburger"></div>
<div class="hamburger"></div>
<div class="hamburger"></div>
</div>
</div>
</a>
<div class="navigation-wrapper">
<ul class="navigation">
<li>Home</li>
<li>Website Design</li>
<li>Search Engine Optimization</li>
<li>User Experience</li>
<li>AB Testing</li>
<li>Contact</li>
</ul>
</div>
would appreciate your kind help.
Thanks in advance
You should do the following things:
add a class like 'active' to the hamburger button when active (Jquery > toggleClass)
the three lines in the button can be animated seperately by making classes for each of them : #menulink.active .hamburger-wrapper .inner-hamburger-wrapper div:nth-of-type(1){}
have transitions and rotation on each .hamburger element : 2 make a cross, 1 disappears.
This question already has answers here:
Transitions on the CSS display property
(37 answers)
Closed 3 years ago.
I'm trying to transition effect for my menu's dropdown, but unlike the other cases, I can't manage to get it work.
I've search lots of theards around here and over google as well. I found no solution.
Here's my code:
.dropdown2 {
position: relative;
display: inline-block;
}
.dropdown-content2 {
display: none;
position: absolute;
background-color: #e1e1e1;
color: #000;
min-width: 150px;
height: 220px;
z-index: 999;
font-size: 20px;
margin-right: -10px;
top: 34px;
transition: height 2s;
}
.dropdown-content2 a {
padding: 12px 16px;
text-decoration: none;
display: block;
border-bottom: 5px solid white;
}
.dropdown2:hover .dropdown-content2 {
display: block;
}
.dropdown2:hover .dropbtn2 {
background-color: #e1e1e1;
}
HTML:
<div class="menu_option dropdown2">articles
<div class="dropdown-content2">
news
reviews
guides
art
</div>
</div>
And it doesn't work.
try like this.. in display none and block transition effect not working.. so now i changed opacity
HTML
<div class="menu_option dropdown2">כל הכתבות
<div class="dropdown-content2">
news
reviews
guides
art
</div>
</div>
css
.dropdown2 {
position: relative;
display: inline-block;
}
.dropdown-content2 {
opacity:0;
visibility:hidden;
position: absolute;
background-color: #e1e1e1;
color: #000;
min-width: 150px;
height: 220px;
z-index: 999;
font-size: 20px;
margin-right: -10px;
top: 34px;
-webkit-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease
}
.dropdown-content2 a {
padding: 12px 16px;
text-decoration: none;
display: block;
border-bottom: 5px solid white;
}
.dropdown2:hover .dropdown-content2 {
opacity:1;
visibility:visible;
-webkit-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease
}
.dropdown2:hover .dropbtn2 {
background-color: #e1e1e1;
}
You can't transition from display: none to display: block.
Fortunately, in this case you don't need to. You only need to transition from height: 0 to height: 220px.
N.B. You also need to ensure that .dropdown-content2 has the style overflow: hidden to ensure that when the content of the parent element exceeds the height, it does not overflow the boundaries and reveal itself.
Working Example:
.dropdown2 {
position: relative;
display: inline-block;
}
.dropdown-content2 {
position: absolute;
background-color: #e1e1e1;
color: #000;
min-width: 150px;
z-index: 999;
font-size: 20px;
margin-right: -10px;
top: 34px;
overflow: hidden;
}
.dropdown-content2 a {
padding: 12px 16px;
text-decoration: none;
display: block;
border-bottom: 5px solid white;
}
.dropdown2 .dropdown-content2 {
height: 0;
transition: height 2s;
}
.dropdown2:hover .dropdown-content2 {
height: 220px;
}
.dropdown2:hover .dropbtn2 {
background-color: #e1e1e1;
}
<div class="menu_option dropdown2">articles
<div class="dropdown-content2">
news
reviews
guides
art
</div>
</div>
I have collapsible sidebar with two tabs in my angularjs page but it is not working scroll is not visible on overflow.Requirement is scroll bar is not visible on sidebar overflow i gave scrollbar height to auto and overflow-y to scroll but not running.Does anyone know how to do this ?
Here is my Code:
CSS
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
/*margin-top: 57px;*/
}
#wrapper.toggled {
padding-left: 250px;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0;
/* disini agar ketika di kecilkan tidak hilang semua default 0*/
height: auto;
margin-left: -250px;
overflow-y: hidden;
/* overflow-y: auto, changed to Hidden By VIKAS GAYAKWAD */
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
/*width: 100%;*/
position: absolute;
padding: 15px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -250px;
}
.fixed-brand {
width: auto;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
height: 100%;
top: 0;
width: 250px;
overflow-y: scroll;
margin: 0;
padding: 0;
list-style: none;
margin-top: 2px;
}
.sidebar-nav li {
text-indent: 15px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
border-left: red 2px solid;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
.no-margin {
margin: 0;
}
#media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
.fixed-brand {
width: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
}
#wrapper.toggled-2 #sidebar-wrapper {
width: 50px;
}
#wrapper.toggled-2 #sidebar-wrapper:hover {
width: 250px;
}
#page-content-wrapper {
padding: 20px;
position: relative;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
padding-left: 250px;
}
#wrapper.toggled-2 #page-content-wrapper {
position: relative;
margin-right: 0;
margin-left: -200px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
}
.media-body {
height: 100%;
padding: 4px;
/*margin-top: 5px;*/
/*background:green;*/
}
.media.contact-card {
font-size: 11px;
padding: 5px;
border-bottom: 1px solid #3071a9;
/*color: lightcyan;*/
}
.hr {
border-bottom: 1px solid #e1e1e1;
}
/*slider tab end*/
/* Scrollbar */
.scrollbar {
overflow-y: scroll;
height: auto;
}
Html
<tabset justified="true">
<tab heading="CONTACTS">
<div class="tab-content">
<div>
<div class="pull-right">
<a class="" ui-sref=".client"> <i class="glyphicon glyphicon-plus"></i> Add Contact </a>
</div>
<div class="clearfix"></div>
</div>
<div class="scrollbar">
<!--Start SCROLL BAR, Div Added/Edited by VIKAS GAYAKWAD -->
<div class="hr"></div>
<ul class="media-list">
<contact-card data-client="client" ng-repeat="client in clientList"></contact-card>
</ul>
</div>
<!--End SCROLL BAR--->
</div>
</tab>
<tab heading="RECENT">
<div class="tab-content">
<div ng-repeat="client in clientList">
{{client.firstName}} {{client.lastName}}
</div>
</div>
</tab>
</tabset>
The main problem is probbaly that the scrollbar-<div> has no "Visible" contents except for a <hr>.
Because it is empty except for some unsuported (?) HTML tags, it will show up as a short greyed scrollbar (there simply is nothing to scroll through).
Also, when you do not set the height of the scroll-<div>, the scrollbar will be useless as the DIV stretches along with the content.
You didn't set any max-height for the scrollbar to work. And there's no content inside the .scrollbar element.
Your css for .scrollbar should be like this:
.scrollbar {
overflow-y: scroll;
height: auto;
max-height: 400px;
}
For the scrollbar to appear add this:
.media-list {
height: 450px;
}
Note: The latter isn't necessary if you have contents added, this is just to show you that empty div won't show the scrollbar.
Fiddle
So I'm working on an application for my Software Engineering class, and I've hit a wall with fixing the width of my webpage. Here is a link to a cloud version of the running application: Link to display issue As you can see when the box is rescaled the header changes sizes, and creates a large white box underneath, and also there is always a scroll bar at the bottom even when max size on my monitor.
html, body {
padding: 0px;
margin: 0px;
border: 0px;
height: 100%;
width: 100%;
font-size: 100%;
}
body {
display: block;
background-color: #f7f7f7;
}
body, header, footer, h1 {
font-family: 'Lato', sans-serif;
}
#wrapper {
width: 100%;
height: 100%;
margin: 50px auto;
}
.button {
width: 240px;
height: 45px;
-webkit-border-radius: 2px;
border-radius: 2px;
margin: 0 auto;
cursor: pointer;
}
.facebook {
margin-bottom: 25px;
background-color: #A0BBD6;
-webkit-transition: background-color .2s ease;
-moz-transition: background-color .2s ease;
-ms-transition: background-color .2s ease;
-o-transition: background-color .2s ease;
transition: background-color .2s ease;
}
.facebook:hover {
background-color: #88a5c2;
}
.submit {
margin-top: 20px;
background-color: #a6d7a0;
-webkit-transition: background-color .2s ease;
-moz-transition: background-color .2s ease;
-ms-transition: background-color .2s ease;
-o-transition: background-color .2s ease;
transition: background-color .2s ease;
}
.submit:hover {
background-color: #93c08e;
}
p {
text-align: center;
color: #FFFFFF;
padding: 0 300px;
font-weight: 300;
font-size: 0.8em;
}
.form {
border: thin solid #ededed;
position: relative;
margin: 30px auto;
width: 290px;
height: auto;
background-color: #ffffff;
padding: 30px 0;
-webkit-border-radius: 2px;
border-radius: 2px;
}
input[type=text] {
background: url(http://imageshack.com/a/img812/1096/y67f.png) no-repeat 15px 13px;
}
input[type=password] {
position: relative;
top: -5px;
background: url(http://imageshack.com/a/img812/6980/lcnq.png) no-repeat 15px 13px;
}
input[type=text], input[type=password] {
width: 195px;
height: 40px;
-webkit-border-radius: 2px;
border-radius: 2px;
margin: 0 auto;
display: block;
border: none;
background-color: #EBEBEB;
padding: 2px 0 2px 45px;
-webkit-background-size: 18px;
-o-background-size: 18px;
background-size: 18px;
font-size: 15px;
font-weight: 300;
color: #777;
-webkit-transition: background-color .2s ease;
-moz-transition: background-color .2s ease;
-ms-transition: background-color .2s ease;
-o-transition: background-color .2s ease;
transition: background-color .2s ease;
}
input[type=text]:focus, input[type=password]:focus {
outline: none;
background-color: #f3f3f3;
}
img {
width: 24px;
height: auto;
display: block;
margin: 0 auto;
padding: 11px 0;
}
#header {
padding-left: 50px;
position: relative;
width: 100%;
height: 50px;
font-size: 2.0em;
}
h1 {
font-size: 1.0em;
font-color: black;
}
#navigationBar {
width: 100%;
background-color: #980000;
height: 30px;
text-align: right;
}
#footer {
width: 100%;
height: 40px;
position: relative;
background-color: #980000;
min-width: 100%;
padding-bottom: 0;
}
div {
display: block;
}
a.navButton:link,a.navButton:visited {
color:#000000;
text-decoration:none;
}
a.navButton:hover,a.navButton:active {
color:#FFFFFF;
text-decoration:none;
}
This is because the padding is added to the width.
Use box-sizing: border-box on your header like
#header {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Here's a Fiddle.
Your header and footer is the problem.
First, take away the padding: 0 300px; from the footer > p then take away width: 100% on the header tag since it's really not needed.
I have these codes on my site
HTML-
<ul class="tabs">
<li>
<input type="radio" checked name="tabs" id="tab1">
<label for="tab1">Twitter</label>
<div id="tab-content1" class="tab-content animated fadeIn">
<a class="twitter-timeline" href="https://twitter.com/1THUGRadio" data-widget-id="521855935606583296">Tweets by #1THUGRadio</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab2">
<label for="tab2">Facebook</label>
<div id="tab-content2" class="tab-content animated fadeIn">
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fthugcommunity&width=650&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=500" frameborder="0" scrolling="yes" style="background: white; border: currentColor; border-image: none; width: 650px; height: 500px; overflow: visible; float: left;" allowtransparency="true">
</iframe>
</div>
</li>
</ul>
as you can see it has the FB and Twitter feeds in it
CSS
.tabs input[type=radio] {
position: absolute;
top: -9999px;
left: -9999px;
}
.tabs {
width: 650px;
float: none;
list-style: none;
position: relative;
padding: 0;
margin: 75px auto;
}
.tabs li{
float: left;
}
.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #08C;
font-size: 24px;
font-weight: normal;
font-family: 'Lily Script One', helveti;
background: rgba(255,255,255,0.2);
cursor: pointer;
position: relative;
top: 3px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.tabs label:hover {
background: rgba(255,255,255,0.5);
top: 0;
}
[id^=tab]:checked + label {
background: #08C;
color: white;
top: 0;
}
[id^=tab]:checked ~ [id^=tab-content] {
display: block;
}
.tab-content{
z-index: auto;
display: none;
text-align: left;
width: 100%;
font-size: 20px;
line-height: 140%;
padding-top: 10px;
background: #08C;
padding: 15px;
color: white;
position: absolute;
top: 53px;
left: 0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;.tabs input[type=radio] {
position: absolute;
top: -9999px;
left: -9999px;
}
.tabs {
width: 650px;
float: none;
list-style: none;
position: relative;
padding: 0;
margin: 75px auto;
}
.tabs li{
float: left;
}
.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #08C;
font-size: 24px;
font-weight: normal;
font-family: 'Lily Script One', helveti;
background: rgba(255,255,255,0.2);
cursor: pointer;
position: relative;
top: 3px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.tabs label:hover {
background: rgba(255,255,255,0.5);
top: 0;
}
[id^=tab]:checked + label {
background: #08C;
color: white;
top: 0;
}
[id^=tab]:checked ~ [id^=tab-content] {
display: block;
}
.tab-content{
z-index: 6;
display: none;
text-align: left;
width: 100%;
font-size: 20px;
line-height: 140%;
padding-top: 10px;
background: #08C;
position: relative;
padding: 15px;
color: white;
top: 53px;
left: 0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
animation-duration: 0.5s;
}
animation-duration: 0.5s;
}
When I put the coding in jfiddle.net everything shows up like it should. But when I drop it in the website only the tabs show up, not the content
First off, thanks for the lack of help I got from everyone. So I figured out it needed to have overflow: visible; not hidden.