Accordion Menu always very simple to create at a same time this is very useful to heighlight the text and also content compressing because it hides and shows the particular menu content so it is very efficiant way to avoid the maximum space in the webpages.
In this example i am going to tell you how to create the Horizontal Accordion Menu using css and css3. Usually all are using the vertical accordion menu. But it is Horizontal accordion menu, It is more attractive when comparing to the vertical one. This is also responsive type horizontal Menu.
In this example i am going to tell you how to create the Horizontal Accordion Menu using css and css3. Usually all are using the vertical accordion menu. But it is Horizontal accordion menu, It is more attractive when comparing to the vertical one. This is also responsive type horizontal Menu.
Normal Vertical Accordion Menu is Here.
This was done by using only css3 and html, so it is very easy and simple to implement. The below image shows the how the horizontal accordion menu is looking for, And also code and demo page available to testing purpose. I hope this post is very useful.Html code for Horizontal Accordion Menu:
<h1>Horizontal Accordion Menu using css3</h1>
<div class="san-h-adn">
<form>
<ul>
<li>
<input type="radio" name="group-01" id="group-01-01" />
<label for="group-01-01">Accordion Menu-1</label>
<div>
<h3>Accordion Menu-1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-02" checked="checked" />
<label for="group-01-02">Accordion Menu-2</label>
<div>
<h3>Accordion Menu-2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-03" />
<label for="group-01-03">Accordion Menu-3</label>
<div>
<h3>Accordion Menu-3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-04" />
<label for="group-01-04">Accordion Menu-4</label>
<div>
<h3>Accordion Menu-4</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-05" />
<label for="group-01-05">Accordion Menu-5</label>
<div>
<h3>Accordion Menu-5</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-06" />
<label for="group-01-06">Accordion Menu-6</label>
<div>
<h3>Accordion Menu-6</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
</ul>
</form>
</div>
<h2><a href="http://www.sanwebcorner.com/">www.sanwebcorner.com</a></h2>
<div class="san-h-adn">
<form>
<ul>
<li>
<input type="radio" name="group-01" id="group-01-01" />
<label for="group-01-01">Accordion Menu-1</label>
<div>
<h3>Accordion Menu-1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-02" checked="checked" />
<label for="group-01-02">Accordion Menu-2</label>
<div>
<h3>Accordion Menu-2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-03" />
<label for="group-01-03">Accordion Menu-3</label>
<div>
<h3>Accordion Menu-3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-04" />
<label for="group-01-04">Accordion Menu-4</label>
<div>
<h3>Accordion Menu-4</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-05" />
<label for="group-01-05">Accordion Menu-5</label>
<div>
<h3>Accordion Menu-5</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
<li>
<input type="radio" name="group-01" id="group-01-06" />
<label for="group-01-06">Accordion Menu-6</label>
<div>
<h3>Accordion Menu-6</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
</div>
</li>
</ul>
</form>
</div>
<h2><a href="http://www.sanwebcorner.com/">www.sanwebcorner.com</a></h2>
Css for Horizontal Accordion Menu
.san-h-adn,
.san-h-adn > form > ul > li > div,
.san-h-adn > form > ul > li > label
{
overflow: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.san-h-adn > form > ul,
.san-h-adn > form > ul > *
{
margin: 0;
padding: 0;
list-style: none;
}
.san-h-adn > form > ul,
.san-h-adn > form > ul > li > div
{
height: 220px;
border: 2px solid #174919;
}
.san-h-adn,
.san-h-adn > form > ul > li > input:checked + label
{
background: #4CAF50;;
}
.san-h-adn > form > ul > li > input,
.san-h-adn > form > ul > li > label
{
position: absolute;
}
.san-h-adn > form > ul > li,
.san-h-adn > form > ul > li:last-child
{
border: solid 1px rgba(255,255, 255, .75);
}
.san-h-adn
{
font-family: 'Lato', sans-serif;
padding: 1px;
cursor: default;
}
p{
font-size:14px;
line-height:26px;
text-align:justify;
}
.san-h-adn > form > ul > li > label
{
display: block;
width: 220px;
padding: 0 8px;
letter-spacing: 1px;
font: bold 14px/32px "Lato";
background: #236E26;
color: #fff;
text-align: right;
cursor: pointer;
text-shadow: 0 -1px 0 rgba(0, 0, 0, .5);
text-overflow: ellipsis;
white-space: nowrap;
-webkit-transition: all .3s cubic-bezier(.09, .11, .24, .91);
-moz-transition: all .3s cubic-bezier(.09, .11, .24, .91);
-ms-transition: all .3s cubic-bezier(.09, .11, .24, .91);
-o-transition: all .3s cubic-bezier(.09, .11, .24, .91);
transition: all .3s cubic-bezier(.09, .11, .24, .91);
-webkit-transform: translateX(-100%) rotate(-90deg);
-moz-transform: translateX(-100%) rotate(-90deg);
-ms-transform: translateX(-100%) rotate(-90deg);
-o-transform: translateX(-100%) rotate(-90deg);
transform: translateX(-100%) rotate(-90deg);
-webkit-transform-origin: right top;
-moz-transform-origin: right top;
-ms-transform-origin: right top;
-o-transform-origin: right top;
transform-origin: right top;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.san-h-adn > form > ul > li > input:not(:checked) + label:hover
{
background: #124f15;
}
.san-h-adn > form > ul > li > input:checked + label
{
border-bottom-color: transparent;
color: #ffffff;
}
.san-h-adn > form > ul > li
{
float: left;
padding: 0 32px 0 0;
border-right: 0;
}
.san-h-adn > form > ul > li > input
{
opacity: 0;
}
.san-h-adn > form > ul > li > div
{
width: 0;
font-size: 10px;
color: #fff;
margin: 0 -32px 0 32px;
-webkit-transition: width .3s cubic-bezier(.09, .11, .24, .91);
-moz-transition: width .3s cubic-bezier(.09, .11, .24, .91);
-ms-transition: width .3s cubic-bezier(.09, .11, .24, .91);
-o-transition: width .3s cubic-bezier(.09, .11, .24, .91);
transition: width .3s cubic-bezier(.09, .11, .24, .91);
}
.san-h-adn > form > ul > li > input:checked ~ div
{
width: 460px;
padding: 15px;
overflow: auto;
}
0 Comments