I want to make the container height be auto adjust if the contents overflow it will just go to the flow.
This is the code I have. site: Here
Just forget about the html and focus on css only the css is the one I got error.
.game_wrapper {
width:210px;
height:auto;
position:relative;
background:#fafafa;
background:url(bg1.png);
border:1px dashed #7f7f7f;
padding:3px;
}
.game_container {
width:90px;
height:85px;
border:1px solid #fff;
float:left;
margin:3px;
text-align:center;
-moz-box-shadow: 0px 0px 1px #000000;
-webkit-box-shadow: 0px 0px 1px #000000;
box-shadow: 0px 0px 1px #000000;
border-radius:1px;
padding:3px;
transition: all .2s;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-o-transition: all .2s;
position:relative;
background:url(background.jpg);
background-size:100%;
}
.game_container:hover {
border:1px solid #c0c0c0;
}
.game_container img {
width:100%;
height:70px;
-webkit-filter: brightness(110%);
padding-bottom:3px;
border-bottom:1px solid #afafaf;
transition: all .2s;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-o-transition: all .2s;
background:url(bg2.png);
}
.game_container:hover img {
-webkit-filter: brightness(120%);
}
.game_container .name {
font-size:10px;
color:#0f5f5f;
background:url(bg1.png);
}
.game_container:hover .name {
color:#949400;
font-size:12px;
}
.game_container a:link, .game_container a:visited {
text-decoration:none;
}
.game_container .info {
box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
border:1px solid #a0a0a0;
text-align:justify;
background:#01a2ff;
border-color: #ddd;
position:absolute;
font-family:Verdana,Geneva,sans-serif;
font-size:12px;
color:#E0F7FC;
height:120px;
display:none;
padding:10px;
width:220px;
left:110%;
top:0px;
z-index:1;
}
.game_container .info:before {
content:'';
position:absolute;
left:-6px;
top:15px;
z-index:2;
border-bottom:1px solid #a0a0a0;
border-left:1px solid #a0a0a0;
box-shadow-bottom: inset 0 1px 2px rgba(0,0,0,.07);
box-shadow-left: inset 0 1px 2px rgba(0,0,0,.07);
background:#01a2ff;
height:10px;
width:10px;
display:block;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
}
.game_container:hover .info {
display:block;
}
.game_container .info:hover {
transition: all 0s;
-webkit-transition: all 0s;
-moz-transition: all 0s;
-o-transition: all 0s;
display:none;
}
.game_container .title {
font-size:14px;
color:#E0F7FC;
}
.game_container .description {
margin-top:5px;
color:#F2F9FE;
font-family:Arial;
font-size:10px;
}
Your Example Fixed
you need clearfix to the main wrapper
.clearfix:before, .clearfix:after { content:""; display:table; }
.clearfix:after { clear:both; }
/* IE 6/7 */
.clearfix{ zoom:1; }
add the class .clearfix the the main wrapper
<div class="clearfix game_wrapper">
More abouts clearfix
http://www.sitepoint.com/clearing-floats-overview-different-clearfix-methods/
DEMO
Simply add the overflow:auto; to .game-wrapper
.game_wrapper {
width:210px;
height:auto;
position:relative;
background:#fafafa;
background:url(bg1.png);
border:1px dashed #7f7f7f;
padding:3px;
overflow:auto;
}
Related
This question already has answers here:
How do I remove blue "selected" outline on buttons?
(4 answers)
Closed 4 years ago.
i have a button which have some good ripple effect, that i want persist.
i want to remove the yellow marked one:
here is what i have tried:
button{
background: #fff;
color: #777;
margin: 50px;
position:relative;
}
/* button:link,button:visited{
transition: all .2s;
position:relative;
padding:5px;
background:#fff;
color:black;
display:inline-block;
} */
button:hover{
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
button:active{
transform: translateY(-1px);
box-shadow: 0 5px 10px rgba(0,0,0,0.2);
background:green;
}
button:after{
content:"";
position:absolute;
display:inline-block;
width:100%;
height:100%;
top:0;
left:0;
z-index: -1;
transition: all .4s;
background:green;
}
button:hover::after{
transform: scaleX(1.4) scaleX(1.6);
opacity:0;
outline:none;
}
<button>
hello world
</button>
how to produce:
click the button then you can see the outline
please help me thanks in advance !!!!
Set the outline property to none on the button
button{
background: #fff;
color: #777;
margin: 50px;
position:relative;
outline: none;
}
/* button:link,button:visited{
transition: all .2s;
position:relative;
padding:5px;
background:#fff;
color:black;
display:inline-block;
} */
button:hover{
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
button:active{
transform: translateY(-1px);
box-shadow: 0 5px 10px rgba(0,0,0,0.2);
background:green;
}
button:after{
content:"";
position:absolute;
display:inline-block;
width:100%;
height:100%;
top:0;
left:0;
z-index: -1;
transition: all .4s;
background:green;
}
button:hover::after{
transform: scaleX(1.4) scaleX(1.6);
opacity:0;
outline:none;
}
<button>
hello world
</button>
Note that assigning outline a value of 0 or none will remove the browser's default focus style which can have accessibility conerns.
This question already has answers here:
How can I write a ':hover' condition for 'a:before' and 'a:after'?
(7 answers)
Closed 4 years ago.
I used the following code snippet to get the effect on the Submit buttons in the form.
Codepen Link
HTML:
a.bttn-dark:hover {
color: #FFF;
}
a.bttn-dark:focus {
color: #FFF;
}
.bttn:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
position: absolute;
top: 0;
left: 50%;
right: 50%;
bottom: 0;
opacity: 0;
content: '';
background-color: #FF0072;
z-index: -2;
}
.bttn:hover:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
left: 0;
right: 0;
opacity: 1;
}
<div class="flex">
Continue
</div>
<div class="flex dark">
Continue
</div>
I am confused about the usage of following,
what would be different if a:hover is only used instead of a.bttm-dark:hover ?
bttn:before and bttn:hover:before
why is the pseudo element bttn:hover appearing in the HTML document after bttn element? Shouldn't it come before?
Follow below css code.
CSS:
a.bttn {
color: #FF0072;
text-decoration: none;
}
a.bttn-dark {
color: #644cad;
text-decoration: none;
}
a.bttn:hover {
color: #FFF;
}
a.bttn-dark:hover {
color: #FFF;
}
a.bttn-dark:focus {
color: #FFF;
}
.bttn {
font-size:18px;
letter-spacing:2px;
text-transform:uppercase;
display:inline-block;
text-align:center;
width:270px;
font-weight:bold;
padding:14px 0px;
border:3px solid #FF0072;
border-radius:2px;
position:relative;
box-shadow: 0 2px 10px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.1);
}
.bttn:before {
-webkit-transition:0.5s all ease;
transition:0.5s all ease;
position:absolute;
top:0;
left:50%;
right:50%;
bottom:0;
opacity:0;
content:'';
background-color:#FF0072;
z-index:-2;
}
.bttn:hover {
-webkit-transition:0.5s all ease;
transition:0.5s all ease;
left:0;
right:0;
opacity:1;
}
.bttn:focus {
transition:0.5s all ease;
left:0;
right:0;
opacity:1;
}
.bttn:hover:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
left: 0;
right: 0;
opacity: 1;
}
.bttn-dark {
font-size:18px;
letter-spacing:2px;
text-transform:uppercase;
display:inline-block;
text-align:center;
width:270px;
font-weight:bold;
padding:14px 0px;
border:3px solid #644cad;
border-radius:2px;
position:relative;
box-shadow: 0 2px 10px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.1);
}
.bttn-dark:before {
-webkit-transition:0.5s all ease;
transition:0.5s all ease;
position:absolute;
top:0;
left:50%;
right:50%;
bottom:0;
opacity:0;
content:'';
background-color:#644cad;
z-index:-2;
}
.bttn-dark:hover {
-webkit-transition:0.5s all ease;
transition:0.5s all ease;
left:0;
right:0;
opacity:1;
}
.bttn-dark:focus {
transition:0.5s all ease;
left:0;
right:0;
opacity:1;
}
.bttn-dark:hover:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
left: 0;
right: 0;
opacity: 1;
}
I have a code for a CSS slideshow that goes left and right upon hover. However, when I edit the code to place the images into the slideshow, nothing shows up. This is the slideshow and you can see a working version of it in the bottom left hand corner of the page here; however, I cannot get mine to do the same thing and load the images.
HTML:
<div class="all"><div class="trash"></div><div class="buttons"><div class="back"><div class="goleft"></div><div class="container"><div class="textne"><b>[DESCRIPTION]</b></div>
<div class="imagene"><img src="[IMAGE URL]"></div>
</div></div></div></div><div class="linku"><p>[LINK NAME]</p></div>
CSS:
*{background:none; border:none; margin:0;}
a.external:after {display:none!important;}
span.user-symbol {display:none!important;}
a {font-weight:normal!important;}
.gr-top{display:none;}
.gr-top h2 img{display:none;}
.gr-top h2{display:none;}
.gr-top span{display:none;}
.tri{display:none;}
.gr1{display:none;}
.gr2{display:none;}
.gr3{display:none;}
.commentslink, .prevlink{display:none;}
.hsep{display:none;}
.bottom {display:none;}
.list {display:none;}
.gr-box{
cursor:default;
z-index:99!important;
line-height:1.2em;
font-family:Lucida Console;
font-size:10px;
}
.gr-body, .text{
position:relative;
width:550px;
overflow:hidden;
margin:0px auto;
text-align:center;
}
.back{
width:500px;
height:300px;
background:transparent;
overflow:hidden;
margin-left:0px;
border-left:1px solid #000;
border-right:1px solid #000;
border-bottom:1px solid #000;
}
.container{
width:[CONTAINER WIDTH]px;
height:300px;
margin-left:0px;
text-align:left;
transition:all 5s linear 360s;}
.container:hover{
margin-left:-[MARGIN]px;
transition:all 5s linear;
}
.goleft {
position:absolute;
background:#000;
opacity:0;
width:200px;
height:300px;
z-index:9999;
cursor:url(http://orig09.deviantart.net/aa48/f/2015/327/f/2/arrow_by_codingtrash-d9hpzk9.png), auto; }
.goleft:hover + .container{
margin-left:0px;
transition:all 4s linear; }
.container u{
position:relative;
display:inline-block;
text-decoration:none;
width:100px;
height:150px;
overflow:hidden;
padding:50px 30px;
text-align:center; }
.imagene{
position:relative;
display:inline-block;
background:#777;
margin-top:8px;
margin-left:8px;
height:280px;
border:1px solid #333;
transition:all .4s;
}
.imagene img{
opacity:0.8;
height:280px;
transition:all .4s;
}
.imagene img:hover{
opacity:1;
}
.imagene:hover {
border:1px solid #fff; }
.textne{
position:relative;
display:inline-block;
background:#777;
margin-top:8px;
width:200px;
margin-left:8px;
height:280px;
border:1px solid #333;
transition:all .4s;
}
.textne b{
text-align:center;
color:white;
opacity:0.8;
font-weight: normal;
position:absolute;
padding:110px 50px;
transition:all .4s;
}
.trash {
position:absolute;
width:500px;
height:150px;
background:#999;
margin-top:75px;
z-index:-9;
border:1px solid #000;
}
.all {
margin-left:-10px;}
.linku{
display:inline-block;
height:30px;
border:1px solid #000;
color:#222;
margin-top:-1px;
margin-left:-30px;
text-align:left;
width:200px;
background:#999;
overflow:hidden;
transition:all .3s;
}
.linku:hover {
background:#888;
color:#000;
border:1px solid #fff;
border-top:1px solid #000;
}
.linku p{
text-align:center;
width:200px;
padding-top:10px;
transition:all .3s;
}
The code works fine. You need to include proper "width" and "margin" property in the container and container:hover css rule
I have attached a fiddle link.
.container{
width: 1700px;
height:300px;
margin-left:0px;
text-align:left;
transition:all 5s linear 360s;
}
.container:hover{
margin-left:-1015px;
transition:all 5s linear;
}
https://jsfiddle.net/karthick6891/z9atpexz/
Note: The whole carousel depends on lot of hardcoded values and you have to give proper image sizes to fit the content within it. Kindly look into some carousel's like slick carousel or owl carousel etc.,
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
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