larson larson - 4 months ago 20
CSS Question

CSS transformation with object

I have a question regarding CSS transformation. I made a Dropdown menu in which the dropdown (submenu) should have a special shape. See here:
https://drive.google.com/folderview?id=0B5Ki_dh4A-VJY2ZKQUJaQnF5SDQ&usp=sharing

So far I could manage a part of it with:

transform: skewY
. How I can finish the rest as shown in the picture above?

Here is my JSFiddle: http://jsfiddle.net/sxfxs/

Has anybody an idea?

Here is my code:

<!DOCTYPE html>
<html>
<head>
<title>MENUTEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<style>
#menu {
font-family: TrajanProRegular;
position: absolute;
top:100px;
width: 1100px;
height: 70px;
background-color: #484441;
color: #8C8985;
font-weight: bold;
clear: both;
text-align: center;
vertical-align: middle;
line-height: 70px;
display: inline-block;
}

nav {
width: 1100px;
height: 70px;
background: #484441;
line-height: 70px;
position: absolute;
}

nav span {
font: 1.35em 'TrajanProRegular';
}

nav a {
text-decoration: none;
}

nav ul {
text-align: center;
margin-top: -1px;
display: inline-block;
}


ul li {
font: 9px 'PT Sans Narrow';
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul li.drop {
position: relative;
/* float: left;*/
}
ul > li {
display: inline-block;
letter-spacing: 0.11em;
padding: 0 10px 0;
}
ul li a {
line-height: 70px;
padding: 0 10px;
height: 70px;
color: #8C8985;
font: 1.3em/70px TrajanProRegular;
/* font: 10pt/70px TrajanProBold; */
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
border-left: 1px solid #777370;
border-right: 1px solid #777370;
}
ul li a:hover {
color: #eee;
}

.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #239976;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 2;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 185px;
background: #239976;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
-webkit-transform: skewY(3deg);
-moz-transform: skewY(3deg);
-ms-transform: skewY(3deg);
-o-transform: skewY(3deg);
transform: skewY(3deg);
}

.dropOut ul {
float: left;
padding: 10px 0;
-webkit-transform: skewY(-3deg);
-moz-transform: skewY(-3deg);
-ms-transform: skewY(-3deg);
-o-transform: skewY(-3deg);
transform: skewY(-3deg);
}

.dropOutb {
width: 185px;
background: #239976;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
z-index: -1;
}

.dropOut ul li {
text-align: left;
float: left;
width: 150px;
/* padding: 12px 0 10px 15px; */
margin: 0px 3px;
color: #FFF;
/* -webkit-border-radius: 4px;
* -moz-border-radius: 4px;
* border-radius: 4px;
*/
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
}
/* NEW */
.dropOut ul li a{
font: 12px 'PT Sans Narrow';
border: none !important;
/* padding: 5px 0 10px 0px !important; */
text-align: left;
width: 160px !important;
margin: 0px 5px 0px 0px !important;
padding: 5px 0 10px 0px !important;
float: left;
height: 15px !important;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}


.dropOut ul li:hover {
/* background: #CCE5DB; */
/* text-shadow: 2px 2px 2px #FFFFFF; */
/* filter:DropShadow(Color=#fffff, OffX=2, OffY=2); */
}
.dropOut ul li:hover a {
color: #ACD6C6;
}

ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { opacity: 1; margin-top: 0px; }
</style>
</head>
<body>
<div id="menu">
<nav>
<ul>
<li class="drop">
<a href="#"><span>T</span>OPmenu1</a>
<div class="dropdownContain">
<div class="dropOut dropOutb">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#">T1Sub1</a></li>
<li><a href="#">T1Sub2</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu2</a>
<div class="dropdownContain">
<div class="dropOut dropOutb">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#">Topmenu2sub1</a></li>
<li><a href="#">Topmenu2sub2</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu3</a>
<div class="dropdownContain">
<div class="dropOut">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#">TOPmenu3Sub1</a></li>
<li><a href="#">TOPmenu3Sub2</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu4</a>
<div class="dropdownContain">
<div class="dropOut">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#" target="contLiFrame">TOPmenu4Sub1</a></li>
<li><a href="#" target="contLiFrame">TOPmenu4Sub2</a></li>
<li><a href="#" target="contLiFrame">TOPmenu4Sub3</a></li>
<li><a href="#" target="contLiFrame">TOPmenu4Sub4</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu5</a>
<div class="dropdownContain">
<div class="dropOut">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#" target="contLiFrame">TOPmenu5Sub1</a></li>
<li><a href="#" target="contLiFrame">TOPmenu5Sub2</a></li>
<li><a href="#" target="contLiFrame">TOPmenu5Sub3</a></li>
<li><a href="#" target="contLiFrame">TOPmenu5Sub4</a></li>
<li><a href="#" target="contLiFrame">TOPmenu5Sub5</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu6</a>
<div class="dropdownContain">
<div class="dropOut">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#">TOPmenu6Sub1</a></li>
<li><a href="kontakt.html">TOPmenu6Sub2</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->

<li class="drop">
<a href="#"><span>T</span>OPmenu7</a>
<div class="dropdownContain">
<div class="dropOut">
<!--<div class="triangle"></div>-->
<ul>
<li><a href="#" target="contLiFrame">TOPmenu7Sub1</a></li>
<li><a href="#" target="contLiFrame">TOPmenu7Sub2</a></li>
<li><a href="#" target="contLiFrame">TOPmenu7Sub3</a></li>
</ul>
</div> <!-- dropOut -->
</div> <!-- dropdownContain -->
</li> <!-- drop -->
</ul>
</nav>
</div><!-- menu -->
</body>
</html>

Answer

One way is to add the following to .dropOut ul

background: #239976;
margin-bottom: -10px;
margin-top: 10px;

http://jsfiddle.net/myajouri/sxfxs/1/