Text not contain inside div - html

I need to get the text of div with id='form1' and id='form2' to fit inside their respective container. Currently, the number 40 should be inside the white box on the left but for some reason, it got pushed down.I have tried inserting span and div tag inside form1/form2 but it doesn't do anything. I also try word-wrap in CSS and nothing change.
.form1{
width: 20%;
height: 8%;
float: left;
background: white;
margin-top: 55%;
border-radius: 0px 20px 20px 0px;
opacity: .5;
position: absolute;
}
.form2{
width: 20%;
height: 8%;
float: right;
margin-top: 55%;
background: white;
border-radius: 20px 0px 0px 20px;
opacity: .5;
}
.box1{
width: 60%;
height: 50%;
background: url(http://i.imgur.com/lpaxZUu.png) center no-repeat ;
vertical-align:center;
position: absolute;
margin: 30% 20%;
}
#container
{
width: 10em;
height: 12em;
font-size: 2em;
text-align: center;
line-height: 5em;
margin: 3em auto;
border: 2px solid #666;
border-radius: 7px;
position: relative;
overflow: hidden;
}
#container:before
{
content: "";
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
z-index: -1;
background: url(http://i.imgur.com/opsUkHF.png) center ;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s
-o-transition: all 1s;
transition: all 1s;
}
.transform:before {
-webkit-transform: rotate(-30deg);
-moz-transform: rotate(-30deg);
-ms-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
transform: rotate(-30deg);
}
.text1{
width: 100%;
height: 100%;
background: black;
position: absolute;
font-size: 20px;
display: inline-block;
}
<div id="container">
<div class='form1'>40</div>
<div class="box1"></div>
<div class='form2'></div>
</div>
Here is the jsfiddle to illustrate the code : https://jsfiddle.net/xffc49qL/8/

Your form1 containers line-height is the reason why your text is out of the box. change it to line-height: normal, it should bring back the content within the form1. Also, absolute doesn't have any impact in your case, as the element is float already.
All you need to change is form1 elements line-height.
.form1 {
width: 20%;
height: 8%;
float: left;
background: white;
margin-top: 55%;
border-radius: 0px 20px 20px 0px;
opacity: .5;
line-height: normal;
}
.form2 {
width: 20%;
height: 8%;
float: right;
margin-top: 55%;
background: white;
border-radius: 20px 0px 0px 20px;
opacity: .5;
}
.box1 {
width: 60%;
height: 50%;
background: url(http://i.imgur.com/lpaxZUu.png) center no-repeat;
vertical-align: center;
position: absolute;
margin: 30% 20%;
}
#container {
width: 10em;
height: 12em;
font-size: 2em;
text-align: center;
line-height: 5em;
margin: 3em auto;
border: 2px solid #666;
border-radius: 7px;
position: relative;
overflow: hidden;
}
#container:before {
content: "";
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
z-index: -1;
background: url(http://i.imgur.com/opsUkHF.png) center;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s -o-transition: all 1s;
transition: all 1s;
}
.transform:before {
-webkit-transform: rotate(-30deg);
-moz-transform: rotate(-30deg);
-ms-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
transform: rotate(-30deg);
}
.text1 {
width: 100%;
height: 100%;
background: black;
position: absolute;
font-size: 20px;
display: inline-block;
}
<div id="container">
<div class='form1'>40</div>
<div class="box1"></div>
<div class='form2'></div>
</div>

use position:absolute to fix your variable on a particular position
#test{
position:absolute;
margin-top:-62px;
margin-left:-10px;
}
.form1{
width: 20%;
height: 8%;
float: left;
background: white;
margin-top: 55%;
border-radius: 0px 20px 20px 0px;
opacity: .5;
position: absolute;
}
.form2{
width: 20%;
height: 8%;
float: right;
margin-top: 55%;
background: white;
border-radius: 20px 0px 0px 20px;
opacity: .5;
}
.box1{
width: 60%;
height: 50%;
background: url(http://i.imgur.com/lpaxZUu.png) center no-repeat ;
vertical-align:center;
position: absolute;
margin: 30% 20%;
}
#container
{
width: 10em;
height: 12em;
font-size: 2em;
text-align: center;
line-height: 5em;
margin: 3em auto;
border: 2px solid #666;
border-radius: 7px;
position: relative;
overflow: hidden;
}
#container:before
{
content: "";
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
z-index: -1;
background: url(http://i.imgur.com/opsUkHF.png) center ;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s
-o-transition: all 1s;
transition: all 1s;
}
.transform:before {
-webkit-transform: rotate(-30deg);
-moz-transform: rotate(-30deg);
-ms-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
transform: rotate(-30deg);
}
.text1{
width: 100%;
height: 100%;
background: black;
position: absolute;
font-size: 20px;
display: inline-block;
}
<div id="container">
<div class='form1'><div id='text1'><span id="test">40</span></div></div>
<div class="box1"></div>
<div class='form2'></div>
</div>

Add margin-top: -64px; in #test to get it positioned inside the box
.form1{
width: 20%;
height: 8%;
float: left;
background: white;
margin-top: 55%;
border-radius: 0px 20px 20px 0px;
opacity: .5;
position: absolute;
}
.form2{
width: 20%;
height: 8%;
float: right;
margin-top: 55%;
background: white;
border-radius: 20px 0px 0px 20px;
opacity: .5;
}
.box1{
width: 60%;
height: 50%;
background: url(http://i.imgur.com/lpaxZUu.png) center no-repeat ;
vertical-align:center;
position: absolute;
margin: 30% 20%;
}
#container
{
width: 10em;
height: 12em;
font-size: 2em;
text-align: center;
line-height: 5em;
margin: 3em auto;
border: 2px solid #666;
border-radius: 7px;
position: relative;
overflow: hidden;
}
#container:before
{
content: "";
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
z-index: -1;
background: url(http://i.imgur.com/opsUkHF.png) center ;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s
-o-transition: all 1s;
transition: all 1s;
}
.transform:before {
-webkit-transform: rotate(-30deg);
-moz-transform: rotate(-30deg);
-ms-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
transform: rotate(-30deg);
}
.text1{
width: 100%;
height: 100%;
background: black;
position: absolute;
font-size: 20px;
display: inline-block;
}
#test
{
margin-top: -64px;
}
<div id="container">
<div class='form1'><div id='text1'>40</div></div>
<div class="box1"></div>
<div class='form2'></div>
</div>

Can you explain why you are using line-height? If you remove line-height, the code works. Try it in fiddle. Comment out line-height in #container style. The text '0' will move inside the form1 and form2.

Related

text won't show up when hovering

For my website I want to use a hover function that shows text once hovering over an imgae with the mouse.
Because I want to implement multiple pictures I used a table whichin each td represents one image.
My problem is that once hovering, the overlay shows but there is no text displayed
I'm a complete beginner in html and css, so if there is anything else I can do different and more efficiently, feel free to let me know.
.container {
position: relative;
width: 50%;
}
.moon {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: relative;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 300px;
width: 300px;
opacity: 0;
transition: .5s ease;
background-color: white;
}
.container:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.text {
color: blue;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.mr {
position: relative;
float: left;
width: 300px;
padding-left: 40px;
}
.mr:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.plant {
position: relative;
width: 300px;
padding-left: 40px;
padding-right: 120px;
float: left;
}
.plant:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.karteone {
position: relative;
width: 300px;
padding-top: 40px;
}
.karteone:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.kartetwo {
position: relative;
float: left;
width: 300px;
padding-top: 39.5px;
padding-left: 40px;
}
.kartetwo:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
<body>
<div class="Arbeitsprobe">
<h2 class="myworksample">My Work Samples.</h2>
<h5>Graphic Illustrator</h5>
<center>
<table>
<tr>
<td>
<div class="container">
<img class="moon" src="images/moon.png" alt="moon">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</td>
<td><img class="mr" src="images/mr.me.png" alt="mr"></td>
<td><img class="plant" src="images/plant planet.png" alt="plant"></td>
</tr>
</table>
</center>
</div>
</body>
You could use tooltip class from css. This will display the tooltip text while hovering.
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
}
.tooltip:hover .tooltiptext {
visibility: visible;
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>
If you want the .overlay to appear on .container:hover, then the code sould be: .container:hover .overlay, like so:
.container {
position: relative;
width: 50%;
}
.moon {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: relative;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 300px;
width: 300px;
opacity: 0;
transition: .5s ease;
background-color: white;
}
.container:hover .overlay{
opacity: 0.6;
filter: alpha(opacity=10);
}
.text {
color: blue;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.mr {
position: relative;
float: left;
width: 300px;
padding-left: 40px;
}
.mr:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.plant {
position: relative;
width: 300px;
padding-left: 40px;
padding-right: 120px;
float: left;
}
.plant:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.karteone {
position: relative;
width: 300px;
padding-top: 40px;
}
.karteone:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.kartetwo {
position: relative;
float: left;
width: 300px;
padding-top: 39.5px;
padding-left: 40px;
}
.kartetwo:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
<body>
<div class="Arbeitsprobe">
<h2 class="myworksample">My Work Samples.</h2>
<h5>Graphic Illustrator</h5>
<center>
<table>
<tr>
<td>
<div class="container">
<img class="moon" src="images/moon.png" alt="moon">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</td>
<td><img class="mr" src="images/mr.me.png" alt="mr"></td>
<td><img class="plant" src="images/plant planet.png" alt="plant"></td>
</tr>
</table>
</center>
</div>
</body>
Or apply before and/or after in the CSS, like this:
.container {
position: relative;
width: 50%;
}
.moon {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: relative;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 300px;
width: 300px;
opacity: 0;
transition: .5s ease;
background-color: white;
}
.container:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.text {
color: blue;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.mr {
position: relative;
float: left;
width: 300px;
padding-left: 40px;
}
.mr:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.plant {
position: relative;
width: 300px;
padding-left: 40px;
padding-right: 120px;
float: left;
}
.plant:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.karteone {
position: relative;
width: 300px;
padding-top: 40px;
}
.karteone:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
.kartetwo {
position: relative;
float: left;
width: 300px;
padding-top: 39.5px;
padding-left: 40px;
}
.kartetwo:hover {
opacity: 0.6;
filter: alpha(opacity=10);
}
/* new code from here */
.moon::after {
content: "Hello World";
color: #ffffff;
border: 1px solid #ffffff;
padding: 10px 40px;
display: inline-block;
top: 0;
position: absolute;
margin-top: 55px;
text-align: center;
line-height: 30px;
left: 50px;
text-transform: uppercase;
opacity: 0;
-webkit-transition: opacity 0.35s ease-in-out;
-moz-transition: opacity 0.35s ease-in-out;
-ms-transition: opacity 0.35s ease-in-out;
-o-transition: opacity 0.35s ease-in-out;
transition: opacity 0.35s ease-in-out;
}
.moon:hover::before {
opacity: 1;
transition: opacity 0.35s ease-in-out;
content: "";
background: rgba(0, 0, 0, 0.8);
display: inline-block;
width: 271px;
height: 167px;
top: 0;
position: absolute;
left: 0px;
}
.moon:hover::after {
content: "Hello World";
color: #ffffff;
border: 1px solid #ffffff;
padding: 10px 40px;
display: inline-block;
top: 0;
position: absolute;
margin-top: 55px;
text-align: center;
line-height: 30px;
left: 50px;
text-transform: uppercase;
opacity: 1;
transition: opacity 0.35s ease-in-out;
}
<body>
<div class="Arbeitsprobe">
<h2 class="myworksample">My Work Samples.</h2>
<h5>Graphic Illustrator</h5>
<center>
<table>
<tr>
<td>
<div class="container">
<img class="moon" src="images/moon.png" alt="moon">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</td>
<td><img class="mr" src="images/mr.me.png" alt="mr"></td>
<td><img class="plant" src="images/plant planet.png" alt="plant"></td>
</tr>
</table>
</center>
</div>
</body>

How to make not completed borders around an element in CSS?

I want it to be like this shape .
Just tell me how to make the not completed borders.
And one last thing is that I have to use one div.<div>Elzero</div> with pseudo-elements
Thanks in advance.
you can make it with transparent border
div
{
background-color: #ddd;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 30px;
margin: 40px auto;
color: black;
width: 200px;
height: 200px;
border-radius: 50%;
position: relative;
}
div::before
{
content: "";
width: 200px;
height: 200px;
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
transform: translate(-10px, -10px);
z-index: -1;
border: 10px solid;
border-color: red red red transparent;
}
body ::after
{
content: "";
width: 220px;
height: 220px;
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
transform: translate(-21px, -22px);
z-index: -8;
border: 12px solid;
background: transparent;
border-color: blue transparent blue blue;
}
<div></div>
Try That Bro :)
div {
background-color: #eee;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 30px;
margin: 50px auto;
height: 200px;
width: 200px;
border-radius: 50%;
position: relative;
}
div::before{
content: "";
height: 200px;
width: 200px;
border-radius: 50%;
border: 10px solid #03a9f4;
border-left-color: transparent;
position: absolute;
top: 0;
left: 0;
transform: translate(-10px, -10px);
z-index: -1;
transition: transform 0.5s linear;
}
div:hover::before{
transform: translate(-10px, -10px) rotate(360deg);
}
div::after {
content: "";
height: 220px;
width: 220px;
border-radius: 50%;
border: 10px solid #e91e63;
border-right-color: transparent;
position: absolute;
top: 0;
left: 0;
transform: translate(-20px, -20px);
z-index: -2;
transition: transform 0.5s 0.5s linear;
}
div:hover::after{
transform: translate(-20px, -20px) rotate(360deg);
}
Just put the text/string 'HERE' in a anchor tag like this:
HERE

CSS Hover Not Centering

I am creating a div which will enclose a users name and when they hover over a profile image then it will display the name over the image, when I am doing this it does not center the div over the image solely which will be causing a problem when styling the website.
My CSS is below:
.miniProfileImage {
border-radius: 100%;
border: 3px dashed #28A745;
width: 100%;
max-width: 200px;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
opacity: 1;
display: block;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.img-container {
position: relative;
width: 50%;
}
.img-container:hover .miniProfileImage {
opacity: 0.3;
}
.img-container:hover .middle {
opacity: 1;
}
.middleText {
background-color: #4CAF50;
color: white;
font-size: 16px;
padding: 16px 32px;
}
A sample HTML mark-up can be seen here:
<div class='img-container'>
<img class='miniProfileImage' src='http://via.placeholder.com/500x500'>
<div class='middle'>
<p class='middleText'>Some Name</p>
</div>
</div>
I have also created a JS Fiddle to represent what is happening
.miniProfileImage {
border-radius: 100%;
border: 3px dashed #28A745;
width: 100%;
max-width: 200px;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
opacity: 1;
display: block;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.img-container {
position: relative;
width: 50%;
}
.img-container:hover .miniProfileImage {
opacity: 0.3;
}
.img-container:hover .middle {
opacity: 1;
}
.middleText {
background-color: #4CAF50;
color: white;
font-size: 16px;
padding: 16px 32px;
}
<div class='img-container'>
<img class='miniProfileImage' src='http://via.placeholder.com/500x500'>
<div class='middle'>
<p class='middleText'>Some Name</p>
</div>
</div>
Thanks
That's because your surrounding <div class='img-container'> has a width that is wider than the image.
If you want the div to have the same size as the image, you can do the following:
.img-container {
position: relative;
display: inline-block;
}
.miniProfileImage {
border-radius: 100%;
border: 3px dashed #28A745;
width: 100%;
max-width: 200px;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
opacity: 1;
display: block;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.img-container {
position: relative;
display: inline-block;
}
.img-container:hover .miniProfileImage {
opacity: 0.3;
}
.img-container:hover .middle {
opacity: 1;
}
.middleText {
background-color: #4CAF50;
color: white;
font-size: 16px;
padding: 16px 32px;
}
<div class='img-container'>
<img class='miniProfileImage' src='http://via.placeholder.com/500x500'>
<div class='middle'>
<p class='middleText'>Some Name</p>
</div>
</div>
please correct the CSS like this
.img-container {
position: relative;
width: 100%;
max-width: 210px;
}
and .middle {white-space:nowrap} you can give .miniProfileImage {max-width:100%} to image

Rotating a div from the top left, transform-origin isn't working

I am trying to simulate n amount of boxes rotating from the bottom-right position of the preposition div.
So, basically, I want the top left absolute position of n, be the same as the bottom right absolute position of n - 1. I really hope I explained this well enough, I just don't want there to be a gap, and want the boxes to rotate from the top left without moving to the right or to the bottom.
I tried adding transform-origin: 0 0; but it still won't work.
I appreciate any help, thank you in advance.
Here is the CSS:
.con {
margin: 50px;
width: 100px;
clear: both;
position: relative;
}
.box:nth-child(5) {
width: 150px;
height: 150px;
outline: 1px solid black;
margin-left: -15px;
margin-top: -15px;
position: absolute;
transform-origin: 0 0;
transform: translate(140px, 140px) rotate(10deg);
}
.box:nth-child(4) {
width: 120px;
height: 120px;
outline: 1px solid black;
margin-left: 138px;
margin-top: 138px;
position: absolute;
transform-origin: 0 0;
transform: translate(110px, 110px) rotate(10deg);
}
.box:nth-child(3) {
width: 90px;
height: 90px;
outline: 1px solid black;
margin-left: 261px;
margin-top: 261px;
position: absolute;
transform-origin: 0 0;
transform: translate(80px, 80px) rotate(10deg);
}
.box:nth-child(2) {
width: 60px;
height: 60px;
outline: 1px solid black;
margin-left: 354px;
margin-top: 354px;
position: absolute;
transform-origin: 0 0;
transform: translate(50px, 50px) rotate(10deg);
}
.box:nth-child(1) {
width: 30px;
height: 30px;
outline: 1px solid black;
margin-left: 417px;
margin-top: 417px;
position: absolute;
transform-origin: 0 0;
transform: translate(20px, 20px) rotate(10deg);
}
And the HTML
<div class='con'>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
<div class='box'></div>
</div>
This is what it looks like now:
And here is the the codepen where you can see the sandbox live.
I assume this is what you are after.
View the link for the code to make sence.
http://codepen.io/anon/pen/bppRBx?editors=1111
.con {
margin: 50px;
width: 100px;
clear: both;
position: relative;
}
.box:nth-child(5) {
width: 150px;
height: 150px;
outline: 1px solid black;
margin-left: 0px;
margin-top: 0px;
position: absolute;
transform-origin: 0 0;
transform: rotate(0deg);
}
.box:nth-child(4) {
width: 120px;
height: 120px;
outline: 1px solid black;
margin-left: 149.99962px;
margin-top: 149.99962px;
position: absolute;
transform-origin: 0 0;
transform: rotate(-10deg);
}
.box:nth-child(3) {
width: 90px;
height: 90px;
outline: 1px solid black;
margin-left: 289.01398px;
margin-top: 247.33853px;
position: absolute;
transform-origin: 0 0;
transform: rotate(-20deg);
}
.box:nth-child(2) {
width: 60px;
height: 60px;
outline: 1px solid black;
margin-left: 404.36784px;
margin-top: 301.12891px;
position: absolute;
transform-origin: 0 0;
transform: rotate(-30deg);
}
.box:nth-child(1) {
width: 30px;
height: 30px;
outline: 1px solid black;
margin-left: 486.32916px;
margin-top: 323.09038px;
position: absolute;
transform-origin: 0 0;
transform: rotate(-40deg);
}
To calculate the start point of each new rectangle you need to use some trigonmetry to calculate the end position of the last one. Since this is not included in SASS/CSS you have to write your own functions.
Daniel Perez Alvarez did a nice blog post on how to create simmplified versions of COS/SIN functions in SASS:
https://unindented.org/articles/trigonometry-in-sass/
use css attribute 'transform':
.your-class:hover {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transition: transform 0.8s ease;
-webkit-transition: -webkit-transform 0.8s ease;
-moz-transition: -moz-transform 0.8s ease;
-o-transition: -o-transform 0.8s ease;
}

How can I fix the hover and transition on my nav menu?

I'm building a vertical tabbed navigation menu.
I'm having two problems when I hover over the tabs.
First, only the tab that is hovered is supposed to expand. But what actually happens is multiple tabs expand.
Second, the expand transition is not smooth. It's very jerky and annoying.
I've gone through my code but can't figure it out. What am I missing?
Each tab should expand smoothly and by itself when hovered.
Any feedback would be appreciated.
Live site: http://gearbags.com/store/shop/
HTML:
<!-- First Tab -->
<div id="slideout">
<img src="http://i.imgur.com/Y4LMQhS.png" alt="tab" />
<div id="slideout_inner">
<h4>ACCESSORIES</h4><br />
<h4>LXFB30</h4>
<h4>LXGC-HD</h4>
<h4>LXFGS</h4>
<h4>LXFGS-HD</h4>
<h4>LXMK-A</h4>
<h4>LXMK-B</h4>
<h4>LXMK-C</h4>
<h4>LXMK-D</h4>
<h4>LXMK-E</h4>
</div>
</div>
<!-- Second Tab -->
<div id="slideout-fire">
<img src="http://i.imgur.com/Y4LMQhS.png" alt="tab" />
<div id="slideout_inner_fire">
<h4>FIREFIGHTER</h4><br />
<h4>LXFB30</h4>
<h4>LXGC-HD</h4>
<h4>LXFGS</h4>
<h4>LXFGS-HD</h4>
<h4>LXMK-A</h4>
<h4>LXMK-B</h4>
<h4>LXMK-C</h4>
<h4>LXMK-D</h4>
<h4>LXMK-E</h4>
</div>
</div>
<!-- Third Tab -->
<div id="slideout-medical">
<img src="http://i.imgur.com/Y4LMQhS.png" alt="tab" />
<div id="slideout_inner_medical">
<h4>MEDICAL</h4><br />
<h4>LXMB5-HP</h4>
<h4>LXMB15</h4>
<h4>LXMB20</h4>
<h4>LXMB30</h4>
<h4>LXMB35</h4>
<h4>LXMB40</h4>
<h4>LXMB50</h4>
<h4>LXMB65</h4>
<h4>LXMK-A</h4>
<h4>LXMK-B</h4>
<h4>LXMK-C</h4>
<h4>LXMK-D</h4>
<h4>LXMK-E</h4>
</div>
</div>
<!-- Fourth Tab -->
<div id="slideout-tactical">
<img src="http://i.imgur.com/Y4LMQhS.png" alt="tab" />
<div id="slideout_inner_tactical">
<h4>TACTICAL</h4><br />
<h4>LXPB10</h4>
<h4>LXPB40</h4>
</div>
</div>
CSS
/* ---------- First Tab ---------- */
#slideout {
position: fixed;
top: 40px;
left: -500px;
width: 500px;
height: 140px;
padding: 12px 0;
text-align: center;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
-webkit-border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
z-index: 999;
}
#slideout img {
position: relative;
left: 75px;
/* margin-left: -860px; */
width: 500px;
height: 200px;
top: 0;
z-index: 0;
/*
position: relative;
margin-left: -430px;
width: 500px;
height: 200px;
top: -58px;
z-index: 0;*/
}
#slideout_inner {
position: fixed;
top: 70px;
/*left: -300px;*/
left: -250px;
width: 400px;
padding: 25px;
height: 120px;
line-height: 1.5em;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
text-align: center;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-webkit-border-radius: 0 0 5px 0;
-moz-border-radius: 0 0 5px 0;
border-radius: 0 0 5px 0;
z-index: 9999;
}
#slideout_inner a {
text-decoration: none;
color: #5a5683;
}
#slideout:hover {
/*left: 320px;*/
/* left: 380px; */
left: -155px;
}
#slideout:hover #slideout_inner {
/*left: 35px;*/
left: 125px;
}
.vertical-text {
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
}
.gbtitle {
margin: 0px;
padding: 0 100px;
text-decoration: none;
color: #5a5683;
text-align: right;
z-index: 1;
}
.gbtitle a {
text-decoration: none;
color: #5a5683;
}
.gbtitle a:hover {
text-decoration: none;
color: #FF6824;
}
#slideout_inner a:hover {
color: #FF6824;
}
/* ---------- Second Tab ---------- */
#slideout-fire {
position: fixed;
top: 220px;
left: -500px;
width: 500px;
height: 140px;
padding: 12px 0;
text-align: center;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
-webkit-border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
z-index: 999;
}
#slideout-fire img {
position: relative;
/* margin-left: -860px; */
left: 75px;
width: 500px;
height: 200px;
top: 0;
z-index: 0;
/*
position: relative;
margin-left: -430px;
width: 500px;
height: 200px;
top: -58px;
z-index: 0;*/
}
#slideout_inner_fire {
position: fixed;
top: 250px;
/*left: -300px;*/
left: -250px;
width: 400px;
padding: 25px;
height: 120px;
line-height: 1.5em;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
text-align: center;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-webkit-border-radius: 0 0 5px 0;
-moz-border-radius: 0 0 5px 0;
border-radius: 0 0 5px 0;
z-index: 9999;
}
#slideout_inner_fire a {
text-decoration: none;
color: #5a5683;
}
#slideout-fire:hover {
/*left: 320px;*/
left: -115px;
}
#slideout-fire:hover #slideout_inner_fire {
/*left: 35px;*/
left: 125px;
}
.vertical-text {
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
}
.gbtitle {
margin: 0px;
padding: 0 100px;
text-decoration: none;
color: #5a5683;
text-align: right;
z-index: 1;
}
.gbtitle a {
text-decoration: none;
color: #5a5683;
}
.gbtitle a:hover {
text-decoration: none;
color: #FF6824;
}
#slideout_inner_fire a:hover {
color: #FF6824;
}
/* ---------- Third Tab ---------- */
#slideout-medical {
position: fixed;
top: 400px;
left: -500px;
width: 500px;
height: 140px;
padding: 12px 0;
text-align: center;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
-webkit-border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
z-index: 999;
}
#slideout-medical img {
position: relative;
/* margin-left: -860px; */
left: 75px;
width: 500px;
height: 200px;
top: 0;
z-index: 0;
/*
position: relative;
margin-left: -430px;
width: 500px;
height: 200px;
top: -58px;
z-index: 0;*/
}
#slideout_inner_medical {
position: fixed;
top: 430px;
/*left: -300px;*/
left: -250px;
width: 400px;
padding: 25px;
height: 120px;
line-height: 1.5em;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
text-align: center;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-webkit-border-radius: 0 0 5px 0;
-moz-border-radius: 0 0 5px 0;
border-radius: 0 0 5px 0;
z-index: 9999;
}
#slideout_inner_medical a {
text-decoration: none;
color: #5a5683;
}
#slideout-medical:hover {
/*left: 320px;*/
left: -115px;
}
#slideout-medical:hover #slideout_inner_medical {
/*left: 35px;*/
left: 125px;
}
.vertical-text {
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
}
.gbtitle {
margin: 0px;
padding: 0 100px;
text-decoration: none;
color: #5a5683;
text-align: right;
z-index: 1;
}
.gbtitle a {
text-decoration: none;
color: #5a5683;
}
.gbtitle a:hover {
text-decoration: none;
color: #FF6824;
}
#slideout_inner_medical a:hover {
color: #FF6824;
}
/* ---------- Fourth Tab ---------- */
#slideout-tactical {
position: fixed;
top: 580px;
left: -500px;
width: 500px;
height: 140px;
padding: 12px 0;
text-align: center;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
-webkit-border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
z-index: 999;
}
#slideout-tactical img {
position: relative;
/* margin-left: -860px; */
left: 75px;
width: 500px;
height: 200px;
top: 0;
z-index: 0;
/*
position: relative;
margin-left: -430px;
width: 500px;
height: 200px;
top: -58px;
z-index: 0;*/
}
#slideout_inner_tactical {
position: fixed;
top: 600px;
/*left: -300px;*/
left: -250px;
width: 400px;
padding: 25px;
height: 120px;
line-height: 1.5em;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
transition-duration: 0.5s;
-o-transition-duration: 0.5s;
text-align: center;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-webkit-border-radius: 0 0 5px 0;
-moz-border-radius: 0 0 5px 0;
border-radius: 0 0 5px 0;
z-index: 9999;
}
#slideout_inner_tactical a {
text-decoration: none;
color: #5a5683;
}
#slideout-tactical:hover {
/*left: 320px;*/
left: -115px;
}
#slideout-tactical:hover #slideout_inner_tactical {
/*left: 35px;*/
left: 125px;
}
.vertical-text {
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
}
.gbtitle {
margin: 0px;
padding: 0 100px;
text-decoration: none;
color: #5a5683;
text-align: right;
z-index: 1;
}
.gbtitle a {
text-decoration: none;
color: #5a5683;
}
.gbtitle a:hover {
text-decoration: none;
color: #FF6824;
}
#slideout_inner_tactical a:hover {
color: #FF6824;
}
It looks like what's causing multiple tabs to expand when only one is hovered is the width: 400px declaration on all four #slideout_inner-... div children of the main tab container (#slideout-...).
This width is covering an area much greater than the tab it belongs to; it's overlapping other tabs. In testing in Chrome, if you just remove this width, the overlapping disappears and the width expands only enough to fill its content.
So, step one: remove width: 400px on all div children referenced above. This seems to fix the hover issue. The transitions are now smooth. BUT the content is now gone from view.
To fix this, you need to adjust the positioning in the same four slideout_inner-... div children.
Try adding margin-left: 175px to each rule.
You may still need to tweak positioning a bit in order to align the text to your preferences. But I think the adjustments above solve both problems raised in your question.
DEMO: http://jsfiddle.net/wf0658ko/1/
Regarding your transition; you are using the transition-duration property without setting an actual transition.
Add this shorthand property to your tabs and it should solve your problem:
transition:all 0.5s ease-in-out;
The function on the side navigation is funky because your transforms maintain 450px of width and are covering the adjacent tabs.
Side note: if you aren't familiar with Chrome Dev Tools, it's a good place to find answers to your problems (like these).