I am stuck with a problem, I have a nav
and in it i got two div
and in those I got one li
each. I want the div
s to overlap the nav
bar but what is making me stuck is that I want the nav
bar to get rounded corners where the div
overlaps it means that the div
s need to stretch out their corners to make a rounded form for the nav
bar. Is that possible and how could I do that?
ul { list-style: none; } div { display: inline-block; width: 20%; height: 30px; margin: 0; position: relative; text-align: center; -webkit-transform: skew(-40deg); -moz-transform: skew(-40deg); -o-transform: skew(-40deg); background-color: #ddd; } nav { background-color: #777; padding: 0; } li { font-size: 0.8em; position: relative; top: 505; margin-top: -0.4em; -webkit-transform: skew(40deg); -moz-transform: skew(40deg); -o-transform: skew(40deg); }
<nav> <ul> <div class="overlapping_div"> <li>Text in div</li> </div> <div class="overlapping_div"> <li>Text in div</li> </div> </ul> </nav>
li needs to be the direct child of a ul, in order to do what you want maybe try this solution:
<nav>
<ul>
<li class="overlapping_div">
<span>Text in div</span>
</li>
<li class="overlapping_div">
<span>Text in div</span>
</li>
</ul>
</nav>
and the CSS looks like this
ul {
list-style: none;
}
.overlapping_div {
display: inline-block;
width: 20%;
height: 30px;
margin: 0;
position: relative;
text-align: center;
-webkit-transform: skew(-40deg);
-moz-transform: skew(-40deg);
-o-transform: skew(-40deg);
background-color: #ddd;
}
nav {
background-color: #777;
padding: 0;
}
span {
font-size: 0.8em;
position: relative;
top : 5px;
display : block;
-webkit-transform: skew(40deg);
-moz-transform: skew(40deg);
-o-transform: skew(40deg);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.