Content shifting down in DIVs? - html

I'm working on this project here:
https://codepen.io/WHITE-RABBIT/pen/aMzLWy
I've got pretty much everything in place, but when I use zoom to check that my elements stay in place, I find that all of my content shifts downward. The widths pretty much remain the same, but the headers seem to cause some space and also for the life of me I cannot get my links container to not change size. I know there is probably a fairly simple solution for this, but I have been wracking my brain for hours and I just cannot think of what I did wrong here.
I will split this into sections.
Header:
/**HEADER SECTION**/
.header
{
width:100%;
height:5vmin;
max-height:5vmin;
left:0vmin;
top:0vmin;
margin-top:0vmin;
position:relative;
pointer-events:auto;
z-index:30;
background-color:RED;
}
.header h1
{
font-family:Barlow;
font-size:2vmin;
color:#9dc7ff;
font-weight:bold;
text-transform:uppercase;
letter-spacing:0.5vmin;
margin-top:1vmin;
position:relative;
display:inline-block;
background-color:GREEN;
}
.header u
{
text-decoration:none;
font-size:2vmin;
letter-spacing:0.1vmin;
font-weight:100;
font-style:italic;
font-family:'Black Han Sans', sans-serif;
color:#ff6ade;
}
.header-links
{
width:70%;
height:auto;
padding-top:0%;
margin-top:-3.5vmin;
margin-left:24.2vmin;
right:0%;
position:fixed;
float:right;
background-color:BLUE;
}
.header-links a
{
font-family:Roboto;
font-size:1.02vmin;
letter-spacing:0.2vmin;
width:auto;
height:auto;
position:relative;
padding-bottom:2vmin;
padding-top:0vmin;
color:WHITE;
margin-right:2vmin;
text-decoration:none;
text-transform:uppercase;
display:inline;
border-bottom:0vmin solid RGBA(255,255,255,0.0);
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
}
.header-links a:hover
{
border-bottom:2px solid #2de3ff;
color:#ff2dce;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.header span
{
display:inline-block;
width: 0.5vmin;
max-width:0.5vmin;
max-height:0.5vmin;
height: 0.5vmin;
top:-0.1vmin;
margin-right:2vmin;
position:relative;
background-color:#2de3ff;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
Sider:
.sider
{
width:29%;
height:80vmin;
position:relative;
z-index:2;
margin-top:-7vmin;
pointer-events:auto;
background-color:TRANSPARENT;
}
.sider display
{
height:40%;
width:100%;
top:8vmin;
position:relative;
display:inline-block;
background-image:URL('https://i.imgur.com/KrGRmvE.gif');
background-size:cover;
background-position:center;
-webkit-border-radius: 20px 20px 0px 0px;
border-radius: 10% 10% 10% 10%;
}
.title
{
height:4vmin;
width:90%;
left:1vmin;
position:relative;
display:inline-block;
top:9vmin;
font-family:Barlow;
font-size:1.9vmin;
line-height:1.2vmin;
}
.sider desc
{
height:auto;
width:95%;
left:1vmin;
top:10vmin;
position:relative;
display:inline-block;
font-family:'Roboto Condensed', sans-serif;
font-size:1.3vmin;
font-weight:100;
line-height:1.5vmin;
opacity:0.8;
text-align:justify;
letter-spacing:0.03vmin;
}
.title icon
{
height:8vmin;
width:8vmin;
max-height:8vmin;
max-width:8vmin;
display:inline-block;
position:relative;
margin-top:-4vmin;
margin-right:1vmin;
left:0vmin;
float:left;
background-color:PURPLE;
background-image:URL('https://i.redd.it/glxbid0p79r11.jpg');
background-size:cover;
border:0.5vmin solid BLACK;
-webkit-border-radius: 50%px;
border-radius: 50%;
}
.buttons-container
{
height:auto;
width:100%;
margin-top:13vmin;
white-space:nowrap;
font-family:Roboto;
line-height:0vmin;
text-transform:uppercase;
}
.button
{
height:2.3vmin;
width:2.3vmin;
max-height:2.3vmin;
max-width:2.3vmin;
margin-right:1vmin;
display:inline-block;
background-image:URL('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217361/discord-icon-free-download-at-icons8-33230.png');
background-position:center;
background-repeat:no-repeat;
background-size:cover;
}
.button2
{
height:2.3vmin;
width:2.3vmin;
margin-right:1vmin;
display:inline-block;
background-image:URL('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217361/kisspng-league-of-legends-computer-icons-riot-games-wall-decals-5b11738fe19235.371578411527870351924.png');
background-position:center;
background-repeat:no-repeat;
background-size:cover;
}
.buttons-container span
{
top:-0.8vmin;
margin-right:1vmin;
display:inline-block;
position:relative;
background-color:GREEN;
font-size:1vmin;
}
The HTML section can be seen on the pen. I'm not going to post it because I am 99% sure that it has nothing to do with my HTML.
I appreciate everyone's time. Hopefully I can find a solution to this soon. Thank you.

Your design isn't responsive, you're working with your screen size only but when the design is displayed in another screen everything will not be the same as it was in your screen
You can follow this guide to get better results

Related

How to show Link/DIV on hover with moving up the upper div?

I'm trying to build a Team section on a Website. I have a Div with an Image and Name of the Person. When I hover over the name, I would like to have a link to appear on its place and move the Name upwards.
Something like this (TEAM Section):
https://www.templatemonster.com/de/demo/55809.html
I tried using a solution I found here and modifying it, but it doesnt really work like I want it to:
#stuff {
position: absolute;
top: 100px;
opacity: 0.0;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;
transition: all 500ms ease-in-out;
}
#hover {
width:80px;
height:20px;
background-color:green;
margin-top: 50px;
margin-bottom:15px;
}
#hover:hover {
margin-top:25px;
margin-bottom: 25px;
opacity: 1.0;
}
#stuff:hover {
opacity: 1.0;
}
<link rel="stylesheet" type="text/css" href="main.css">
<section>
<div id="hover">Hover</div>
<div id="stuff">stuff</div>
Is there a simple solution with CSS and/or Bootstrap?
I made an example using just css.
section {
margin:5px auto;
}
.hover-div {
color:#FFF;
width:200px;
}
.hover-div .stuff {
background-color:#F00;
height:100px;
margin-top:0;
position:relative;
width:100%;
z-index:2;
-webkit-transition:margin-top 0.3s;
transition:margin-top 0.3s;
}
.hover-div .stuff-hidden {
background-color:#00F;
height:0;
width:100%;
-webkit-transition:height 0.3s;
transition:height 0.3s;
}
.hover-div:hover .stuff {
margin-top:-40px;
}
.hover-div:hover .stuff-hidden {
height:40px;
}
.image {
background-color:#0F0;
height:100px;
text-align:center;
width:100%;
}
<section>
<div class="image">image</div>
<div class="hover-div">
<div class="stuff">Stuff</div>
<div class="stuff-hidden">Hidden stuff</div>
</div>
</section>

Tidying up css code

I have a .css file for my website which does all the formatting for the side navigation bar. The only problem is that it looks messy and it seems to be inefficient as I kept on having to copy the same code again and again only to change one or two value per slide pop out. I am wanting to know how I could make it neater and more efficient.
This is what the relevant css code looks like
nav {
display: block;
color:white;
border:2px;
border-color:aqua;
border-style:solid;
border-right-style:none;
padding:10px;
text-transform: uppercase;
}
/*First nav box*/
#topnav {
top: 100px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:white;
border-bottom-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#topnav:hover span {display:none}
#topnav:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
color:white;
}
#topnav:hover:before {
content:"Top";
}
/*Second nav box*/
#nav2 {
top: 140px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:red;
border-bottom-style:none;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#nav2:hover span {display:none}
#nav2:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
border-top-style:solid;
color:white;
}
#nav2:hover:before {
content:"Red";
}
/*Third nav box*/
#nav3 {
top: 180px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:blue;
border-bottom-style:none;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#nav3:hover span {display:none}
#nav3:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
border-top-style:solid;
color:white;
}
#nav3:hover:before {
content:"blue";
}
/*Fourth nav box*/
#nav4 {
top: 220px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:green;
border-bottom-style:none;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#nav4:hover span {display:none}
#nav4:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
border-top-style:solid;
color:white;
}
#nav4:hover:before {
content:"green";
}
/*Fifth nav box*/
#nav5 {
top: 260px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:purple;
border-bottom-style:none;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#nav5:hover span {display:none}
#nav5:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
border-top-style:solid;
color:white;
}
#nav5:hover:before {
content:"purple";
}
/*Sixth nav box*/
#nav6 {
top: 300px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:orange;
border-bottom-style:none;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#nav6:hover span {display:none}
#nav6:hover {
width:3cm;
background-color:black;
border-bottom-style:solid;
border-top-style:solid;
color:white;
}
#nav6:hover:before {
content:"orange";
}
/*Bot nav box*/
#botnav {
top: 340px;
right: 0px;
position: fixed;
z-index: 3000;
background-color:white;
border-top-style:none;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
vertical-align:
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#botnav:hover span {display:none}
#botnav:hover {
width:3cm;
background-color:black;
border-top-style:solid;
color:white;
}
#botnav:hover:before {
content:"200";
}
Also here is a JSFiddle with the code in practice to show you what it looks like. Also if I need to change the HTML to make the css more efficient let me know.
Thanks for any help
Edit
So based off Darren's answer and Stafox's answer, I have condensed the code to this.
nav {
display: block;
color:white;
border:2px;
border-color:aqua;
border-left-style:solid;
padding:10px;
text-transform: uppercase;
right: 0px;
position: fixed;
z-index: 3000;
width:20px;
height:20px;
line-height: 20px;
text-align:center;
-webkit-transition: 250ms all ease-out;
transition: 250ms all ease-out;
color:black;
}
#topnav:hover, #nav2:hover, #nav3:hover,
#nav4:hover, #nav5:hover, #nav6:hover,
#botnav:hover {
z-index:5000;
width:3cm;
background-color:black;
border-style:solid;
border-right-style:none;
color:white;
}
nav:hover span
{
display:none
}
/*First nav box*/
#topnav {
top: 100px;
background-color:white;
border-top-style:solid;
}
#topnav:hover:before {
content:"Top";
}
/*Second nav box*/
#nav2 {
top: 140px;
background-color:red;
}
#nav2:hover:before {
content:"Red";
}
/*Third nav box*/
#nav3 {
top: 180px;
background-color:blue;
}
#nav3:hover:before {
content:"blue";
}
/*Fourth nav box*/
#nav4 {
top: 220px;
background-color:green;
}
#nav4:hover:before {
content:"green";
}
/*Fifth nav box*/
#nav5 {
top: 260px;
background-color:purple;
}
#nav5:hover:before {
content:"purple";
}
/*Sixth nav box*/
#nav6 {
top: 300px;
background-color:orange;
}
#nav6:hover:before {
content:"orange";
}
/*Bot nav box*/
#botnav {
top: 340px;
background-color:white;
border-bottom-style:solid;
}
#botnav:hover:before {
content:"200";
}
Here is a JSFiddle of it in use.
Are there any other suggestions?
You could group the common navigational elements within a CSS class.
For instance, your topnav, nav2, nav3, nav4 and nav5 all have the following in common:
Colour
Position
Transition
Right
Border
Line height
So it may make more sense to have a base element with these styles rather than repeating them.
.navigation-base {
color: black;
position: fixed;
transition: 250ms all ease-out;
right: 0px;
}
And then apply the navigation-base to all navigational elements and then add an additional class where they differ.
.navigation-unsuccessful {
background-color: red;
}
.navigation-success {
background-color: green;
}
<nav class="navigation-base navigation-success">
<!-- Navigational components -->
</nav>
The idea is to move general properties to common .selector.
And override unique properties if needed.
Something like this: https://jsfiddle.net/Stafox/qrv2h9k5/1/

Making Animated Dropdown Menu by Using Pure CSS Like Bootstrap does

I'm working with my own project to build a stylesheet(CSS) as what bootstrap does. However, I try to use only PURE CSS - no javascript or jquery even flash to do that.
Now, I'm having trouble with the Animated Menu Dropdown when small resizing
as what mobile version looks like.
What I want is:
First, When the browser resize less then 768 and 480 or (55%), the animated circle menu
appears, animating and Menu is hidden. After that, on hover (<div class="acn-menu"></div>), the animated circle menu runs again. When user click or touch the animated circle menu, the animated circle menu stops and the dropdown menu appears and push the
content below it with no scrollbar at the same time as the animated circle rolls back and stops.
Second, How to be compatible with all browsers (even, in IE).
Here's what I have done more than a week: (Sorry for my bad English):
I have just uploaded the sample in this site below:
Demo The Dropdown-Menu
HTML:
<header>
<div id="acn-border"></div><div class="acn-title"><a href="#">
<h1>Appacyber</h1></a></div>
<div class="menu-container">
<div class="acn-menu"></div>
<nav>
<ul class="main-menu">
<li><a href="#" class="home"><span class="fa
fa-home"></span> Home</a></li>
<li><a href="#">Produk <span class="fa fa-caret-
down"></span> </a>
<ul class="sub-menu">
<li>Desain Website</li>
<li>Desain/Edit CMS</li>
<li>Order Template Blogspot</li>
</ul>
</li>
<li><a class="dropdown" href="#">Pembayaran <span
class="fa fa-caret-down"></span> </a>
<ul class="sub-menu">
<li>Via Transfer Bank</li>
<li>Via Pulsa</li>
<li>Via Paypal</li>
</ul>
</li>
<li>Order</li>
<li>Contact</li>
<input type="text" class="input-acn-search"
placeholder="search ..."/><button type="button" class="btn-search">&
gt;</button>
</ul>
</nav>
</div>
</header>
<!--here the content to be pushed when the screen in small rezise-->
STYLESHEET:
<style>
.input-acn-search{
border:1px solid #979797;
padding:7px 34px 7px 7px;
font-size:14px;
font-weight:400;
color:#111;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
margin:7px 0px 0px 10px;
}
.btn-search{
background:#006666;
color:#fff;
border:0px;
font-size:18px;
margin:0px 0px 0px -30px;
-webkit-border-radius:17px;
-moz-border-radius:17px;
border-radius:17px;
border:0px;
min-width:5%;
}
.input-acn-search:hover{
background:#fff;
border:1px solid #979797;
}
.input-acn-search placeholder{
color:#666666;
}
.acn-title{
margin:0px;
height:45px;
padding:0px 25px 0px 25px;
background:#FF9900;
line-height:normal;
vertical-align:middle;
display:table-cell!important;
}
.menu-container{
width:100%;
margin:0px;
height:45px;
padding:0px;
background:#222222;
line-height:normal;
vertical-align:middle;
display:table-cell!important;
}
.acn-title a,.acn-title a h1{
color:#FFFFFF;
font-size:19px;
font-weight:500;
font-style:normal;
font-size-adjust:inherit;
}
.acn-title a:hover,.acn-title a:hover h1{
color:#999;
}
#acn-border{
position:absolute;
width:20px;
height:20px;
border-top:17px solid transparent;
border-left:21px solid #FF9900;
border-bottom:17px solid transparent;
display:table-cell;
margin-top:7px;
margin-left:140px;
z-index:1;
}
ul,li,ul li{
list-style:none;
list-style-image:none;
background:none;
}
/*------menu-------*/
nav ul.main-menu li a{
color:#fff;
}
.home a{
background:#9966CC;
color:#e0e0e0;
-webkit-border-radius:0px 37px 37px 0px;
border-radius:0px 37px 37px 0px;
}
nav ul {
-webkit-font-smoothing:antialiased;
background:#222222;
margin:0;
padding:0;
height:45px;
}
nav li {
float:left;
margin:0;
padding:0;
position:relative;
min-width:110px;
}
nav a {
background:none;
display:block;
font:normal 14px/50px Ubuntu;
padding:0 25px;
text-align:center;
text-decoration: none;
}
li a{
color:#e0e0e0;
background:none;
}
nav li:hover a {
background:#000;
color:#e0e0e0;
}
nav li ul {
float:left;
left:0;
opacity:0.5;
position:absolute;
top:35px;
visibility:hidden;
z-index:1;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
nav li:hover ul {
opacity:1;
top:50px;
visibility:visible;
}
nav li ul li {
float:none;
width:100%;
}
nav li ul a:hover {
background:#666666;
color:#fff;
}
ul.sub-menu{
min-width:180px;
max-width:100%;
}
ul.sub-menu li:hover{
background-color:#000;
color:#fff;
border:0px;
border:none;
}
#media screen and (max-width:55%){/*bila screen maksimum 55% atau sama dengan #bingkai-mini*/}
#media screen and (max-width:768px) and (max-width:480px) {
.acn-menu{
display:block;
visibility:visible;
width:37px;
height:37px;
margin-top:0px;
margin-right:17px;
margin-left:17px;
background:none;
border:10px inset #428BCA;
-webkit-transform:rotate(-180deg);
-moz-transform:rotate(-180deg);
-o-transform:rotate(-180deg);
transform:rotate(-180deg);
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
-webkit-border-radius:50%!important;
-moz-border-radius:50%!important;
-o-border-radius:50%!important;
border-radius:50%!important;
}
.menu-container .acn-menu:hover{
cursor:pointer;
display:block;
visibility:visible;
width:37px;
height:37px;
margin-right:17px;
margin-left:17px;
background:none;
border:10px inset #FF00FF;
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
}
.acn-title{
width:100%;
-webkit-border-radius:0px;
border-radius:0px;
position:relative;
}
.acn-border{
display:none;
}
/*---------------MENU------------------*/
header{
position:relative;
}
nav{
position:absolute;
right:0px;
top:47px;
width:100%;
}
.home a{
background:#9966CC;
color:#e0e0e0;
-webkit-border-radius:0px;
border-radius:0px;
width:100%;
}
nav ul {
-webkit-font-smoothing:antialiased;
background:#222222;
margin:0;
padding:0;
height:45px;
}
nav li {
margin:0;
padding:0;
float:none!important;
position:relative;
text-align:right;
background:#666666;
}
nav ul.main-menu li a{
color:#fff;
}
nav a {
background:none;
display:block;
font:normal 14px/50px Ubuntu;
padding:0 25px;
text-align:center;
text-decoration: none;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
li a{
color:#e0e0e0;
background:none;
}
nav li:hover a {
background:#000;
color:#e0e0e0;
}
nav li ul {
float:left;
left:0;
position:absolute;
top:35px;
visibility:hidden;
z-index:1;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
nav li:hover ul {
opacity:1;
top:50px;
visibility:visible;
}
nav li ul li {
float:none;
width:100%;
}
nav li ul a:hover {
background:#666666;
color:#fff;
}
ul.sub-menu{
width:100%;
min-width:0px;
}
ul.sub-menu li:hover{
position:relative;
background-color:#000;
color:#fff;
border:0px;
border:none;
}
}
</style>
Any helps will be great!
DEMO
html, body {
margin:0;
}
.acn-menu {
text-align: center;
background-color: rgba(0, 0, 0, 0.9);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
min-height: 74px;
width: 100%;
}
.label_openclose {
display: none;
}
.menu-tabs {
height: 100%;
}
.menu-tabs .elem {
box-sizing: border-box;
padding: 0 20px;
float: left;
height: 100%;
line-height: 70px;
background-color: rgb(30, 30, 30);
color: white;
}
#-webkit-keyframes spin {
0% {
transform: rotate(-180deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(-180deg);
}
}
#keyframes spin {
0% {
transform: rotate(-180deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(-180deg);
}
}
.menu-check:checked ~ .label_openclose {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.menu-check {
display: none;
}
.menu-tabs .elem:hover {
background-color: rgba(255, 255, 255, 0.2);
}
/*#media screen and (max-width:55%)*/
#media screen and (max-width:768px) {
.label_openclose {
-webkit-animation: spin 2s;
animation: spin 2s;
display: inline-block;
transform: rotate(-180deg);
transition-duration: 1s;
margin: 10px;
width: 30px;
height: 30px;
border-radius: 50%;
border-top: 10px solid rgb(50, 50, 50);
border-right: 10px solid rgb(100, 100, 100);
border-bottom: 10px solid rgb(150, 150, 150);
border-left: 10px solid rgb(200, 200, 200);
background-color: transparent;
cursor: pointer;
}
.label_openclose:hover {
transform: rotate(180deg);
}
.menu-tabs .elem {
transition: border 1s linear, height 1s;
line-height: initial;
float: initial;
height: 0px;
cursor: pointer;
border-top: 0px solid #000;
overflow: hidden;
}
.menu-tabs:hover .elem {
height: 25px;
}
.menu-check:checked ~ .menu-tabs .elem {
height: 25px;
color: white;
border-top: 2px solid rgba(255, 255, 255, 0.2);
}
.label_openclose:hover ~ .menu-tabs .elem {
border-top: 2px solid rgba(255, 255, 255, 0.2);
height: 25px;
}
}
<div class="acn-menu">
<input type="checkbox" id="openclose" class="menu-check" />
<label class="label_openclose" for="openclose"></label>
<div class="menu-tabs">
<div class="elem">test</div>
<div class="elem">nav</div>
<div class="elem">bar</div>
<div class="elem">with</div>
<div class="elem">transitions</div>
</div>
</div>
<main>
test content of main page
</main>
Animated menu
When the browser resize less then 768 and 480 or (55%), the animated circle menu appears
This i have done with a media query in css: #media screen and (max-width:768px) and setting an animation:
After that, on hover (), the animated circle menu runs again.
This is done with an transform: rotate(180deg); inside an :hover statement.
When user click or touch the animated circle menu, the animated circle menu stops and the dropdown menu appears and push the content below it with no scrollbar at the same time as the animated circle rolls back and stops.
The click is done with an input type="checkbox" element. This is for a special css pseudo selector :checked. This lets us change the style of an :checked. What we do is combine it with an sibling selector so
#input:checked ~ .sibling. Now we can style .sibling while we click on the checkbox. In addition to this added a label for the checkbox. label for="#ID" And hide the actual checkbox with display:none;
Rolling back the circle is done with transform: rotate(180deg);.
Browser support should be ok but, I haven't added all the prefixes for all the transforms and animations.
Transition and animation is CSS3 so IE9 doesn't support it.
Should work in IE10 and above.(probably missing -ms- prefixes)
Tested in Chrome 40.0.
DEMO
Please Try This CSS and your html
<style>
.input-acn-search{
border:1px solid #979797;
padding:7px 34px 7px 7px;
font-size:14px;
font-weight:400;
color:#111;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
margin:7px 0px 0px 10px;
}
.btn-search{
background:#006666;
color:#fff;
border:0px;
font-size:18px;
margin:0px 0px 0px -30px;
-webkit-border-radius:17px;
-moz-border-radius:17px;
border-radius:17px;
border:0px;
min-width:5%;
}
.input-acn-search:hover{
background:#fff;
border:1px solid #979797;
}
.input-acn-search placeholder{
color:#666666;
}
.acn-title{
margin:0px;
height:45px;
padding:0px 25px 0px 25px;
background:#FF9900;
line-height:normal;
vertical-align:middle;
display:table-cell!important;
}
.menu-container{
width:100%;
margin:0px;
height:45px;
padding:0px;
background:#222222;
line-height:normal;
vertical-align:middle;
display:table-cell!important;
}
.acn-title a,.acn-title a h1{
color:#FFFFFF;
font-size:19px;
font-weight:500;
font-style:normal;
font-size-adjust:inherit;
}
.acn-title a:hover,.acn-title a:hover h1{
color:#999;
}
#acn-border{
position:absolute;
width:20px;
height:20px;
border-top:17px solid transparent;
border-left:21px solid #FF9900;
border-bottom:17px solid transparent;
display:table-cell;
margin-top:7px;
margin-left:140px;
z-index:1;
}
ul,li,ul li{
list-style:none;
list-style-image:none;
background:none;
}
/*------menu-------*/
nav ul.main-menu li a{
color:#fff;
}
.home a{
background:#9966CC;
color:#e0e0e0;
-webkit-border-radius:0px 37px 37px 0px;
border-radius:0px 37px 37px 0px;
}
nav ul {
-webkit-font-smoothing:antialiased;
background:#222222;
margin:0;
padding:0;
height:45px;
}
nav li {
float:left;
margin:0;
padding:0;
position:relative;
min-width:110px;
}
nav a {
background:none;
display:block;
font:normal 14px/50px Ubuntu;
padding:0 25px;
text-align:center;
text-decoration: none;
}
li a{
color:#e0e0e0;
background:none;
}
nav li:hover a {
background:#000;
color:#e0e0e0;
}
nav li ul {
float:left;
left:0;
opacity:0.5;
position:absolute;
top:35px;
visibility:hidden;
z-index:1;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
nav li:hover ul {
opacity:1;
top:50px;
visibility:visible;
}
nav li ul li {
float:none;
width:100%;
}
nav li ul a:hover {
background:#666666;
color:#fff;
}
ul.sub-menu{
min-width:180px;
max-width:100%;
}
ul.sub-menu li:hover{
background-color:#000;
color:#fff;
border:0px;
border:none;
}
#media screen and (max-width:55%){/*bila screen maksimum 55% atau sama dengan #bingkai-mini*/}
#media screen and (max-width:768px) {
.acn-menu{
display:block;
visibility:visible;
width:26px;
height:26px;
margin-top:0px;
margin-right:17px;
margin-left:17px;
background:none;
border:10px inset #428BCA;
-webkit-transform:rotate(-180deg);
-moz-transform:rotate(-180deg);
-o-transform:rotate(-180deg);
transform:rotate(-180deg);
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
-webkit-border-radius:50%!important;
-moz-border-radius:50%!important;
-o-border-radius:50%!important;
border-radius:50%!important;
}
.menu-container .acn-menu:hover{
cursor:pointer;
display:block;
visibility:visible;
margin-right:17px;
margin-left:17px;
background:none;
border:10px inset #FF00FF;
-webkit-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
-webkit-transition-duration:2s;
-moz-transition-duration:2s;
-o-transition-duration:2s;
transition-duration:2s;
}
.acn-title{
width:100%;
-webkit-border-radius:0px;
border-radius:0px;
position:relative;
}
.acn-border{
display:none;
}
.main-menu {
max-height: 0px;
overflow:hidden;
height: 250px;
transition: max-height 1s;
}
.menu-container:hover .main-menu {
max-height: 250px;
overflow: visible;
}
#acn-border {
margin-left: 50%;
}
/*---------------MENU------------------*/
header{
position:relative;
}
nav{
position:absolute;
right:0px;
top:47px;
width:100%;
}
.home a{
background:#9966CC;
color:#e0e0e0;
-webkit-border-radius:0px;
border-radius:0px;
width:100%;
}
nav ul {
-webkit-font-smoothing:antialiased;
background:#222222;
margin:0;
padding:0;
height:45px;
}
nav li {
margin:0;
padding:0;
float:none!important;
position:relative;
text-align:right;
background:#666666;
}
nav ul.main-menu li a{
color:#fff;
}
nav a {
background:none;
display:block;
font:normal 14px/50px Ubuntu;
padding:0 25px;
text-align:center;
text-decoration: none;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
li a{
color:#e0e0e0;
background:none;
}
nav li:hover a {
background:#000;
color:#e0e0e0;
}
nav li ul {
float:left;
left:0;
position:absolute;
top:35px;
visibility:hidden;
z-index:1;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
nav li:hover ul {
opacity:1;
top:50px;
visibility:visible;
}
nav li ul li {
float:none;
width:100%;
}
nav li ul a:hover {
background:#666666;
color:#fff;
}
ul.sub-menu{
width:100%;
min-width:0px;
}
ul.sub-menu li:hover{
position:relative;
background-color:#000;
color:#fff;
border:0px;
border:none;
}
}
</style>
It's not necessary to not use javascript due that most peaple always have it enabled, and it has awesome functionalities.
Said the above i found an example on how to help you here: link
There you can find two options, the target pseudo-selector and a CSS3 selector trickery.
hope it helps :3

Keep elements fixed, next to a transforming element

How can i make an element that i transform its width and height not affect its surrounding elements ?
p {
position: relative;
}
.p1 {
width:200px;
height:200px;
border:1px solid blue;
outline: 1px solid green;
display:inline;
text-align:center;
background-color: red;
color: #FFF;
position:relative;
display:inline-block;
float:left;
-webkit-transition: width 2s, height 2s, background-color 2s, -webkit-transform 2s, color 2s;
}
.p1:hover {
width:500px;
height: 500px;
-webkit-transform: rotate(180deg);
color:black;
}
<p class="p1">hello1</p>
<p style="" class="p1">hello2</p>
<p style="" class="p1">hello3</p>
Demo at http://jsfiddle.net/toadalskii/mLx0x56n/
Do not scale it by changing the width/height since those affect the document flow.
Use the scale transform (from 200 to 500 it is a scale of 2.5) so use transform: scale(2.5) rotate(180deg);
body {
width:100%;
}
p {
position: relative;
}
.p1 {
width:200px;
height:200px;
border:1px solid blue;
outline: 1px solid green;
display:inline;
text-align:center;
background-color: red;
color: #FFF;
position:relative;
display:inline-block;
float:left;
-webkit-transition: background-color 2s, -webkit-transform 2s, color 2s;
transition: background-color 2s, transform 2s, color 2s;
}
.p1:hover {
-webkit-transform: scale(2.5) rotate(180deg);
transform: scale(2.5) rotate(180deg);
color:black;
z-index:100;
}
<p class="p1">hello1</p>
<p class="p1">hello2</p>
<p class="p1">hello3</p>
Demo at http://jsfiddle.net/mLx0x56n/1/

Display list in horizontal line - li in html with css

How to modify this code to display list in horizontal line menu
Currently this code displays in vertical
I want it in horizonyal line form
how make it display list in horizontal line form?
<html><head><style>
.metromenu {
display:block;;
position:relative;
width:40%;
margin:0 auto;
z-index:1;
}
.metromenu, .sub-metromenu {
list-style:none;
}
.metromenu li {
display:inline-block;
float:left;
margin-right:2px;
margin-top:2px;
}
.metromenu a{
display:block;
position:relative;
width:120px;
height:32px;
text-decoration:none;
font-family:'arial';
text-align:center;
letter-spacing:2px;
line-height:26px;
color:#fff;
padding:6px 20px 0 20px;
background-color: hsl(200,70%,50%);
-webkit-transition:all 0.2s ease-out;
-moz-transition:all 0.2s ease-out;
-o-transition:all 0.2s ease-out;
}
.metromenu a:hover {
background-color: hsl(200,80%,65%);
}
.metromenu span {
display:inline-block;;
position:absolute;
top:18px;
right:10px;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 6px solid #fff;
}
.metromenu li:hover > a{ /* activates link when mouse over sub-metromenu */
background-color: hsl(200,80%,65%);
}
/*sub-metromenu trigger*/
.metromenu li a:hover ~ ul{
opacity:1;
visibility:visible;
}
.sub-metromenu {
opacity:0;
visibility:hidden;
position:absolute;
z-index:10;
-webkit-transition:all 0.2s ease-out;
-moz-transition:all 0.2s ease-out;
-o-transition:all 0.2s ease-out;
}
.sub-metromenu:hover {
opacity:1;
visibility:visible;
}
.sub-metromenu li a{
background-color: hsl(250,70%,60%);
}
.sub-metromenu li:first-child a{
height:72px;
}
.sub-metromenu li a:hover{
background-color: hsl(250,80%,70%);
}
.metromenu .orange {
background-color: hsl(20,70%,60%);
}
.metromenu .orange:hover {
background-color: hsl(20,80%,70%);
}
.metromenu .green {
background-color: hsl(110,60%,60%);
}
.metromenu .green:hover {
background-color: hsl(110,70%,70%);
}
</style>
</head>
<body>
<div>
<ul class="metromenu">
<li>Web Tools</li>
<li>Smartphones<span></span>
<ul class="sub-metromenu">
<li>Latest Smartphones</li>
<li>Windows</li>
<li>Android</li>
</ul>
</li>
<li>Others</li>
</ul>
</div> </body> </html>
I took code from here http://codepen.io/maxim/pen/DrvLx
Try this
.metromenu {
display: block;
margin: 0 auto;
position: relative;
width: 100%;
z-index: 1;
}
I changed the width from 40% to 100%. Here is the fiddle. Let me know if this was helpful or if you have any queries.
Edit I [sub menu fix]: Also set the width for sub-menu or they will go vertical.
.sub-metromenu {
opacity:0;
visibility:hidden;
position:absolute;
z-index:10;
-webkit-transition:all 0.2s ease-out;
-moz-transition:all 0.2s ease-out;
-o-transition:all 0.2s ease-out;
width: 10%;
}
Updated fiddle