Struggling to Make Text Overlay Transparent and Slide Only to the Right

Can someone help me make my image have an opaque overlay with text that slides only right when hovered over? Currently, it's sliding both right and up. Any suggestions on how to fix this issue would be greatly appreciated. Thank you.

html, body{
  margin:0em;
  padding:0em;
}
a{
  text-decoration:none;
  color:white;
  
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 300;
  src: local('Lato Light'), local('Lato-Light'), url(http://fonts.gstatic.com/s/lato/v11/dPJ5r9gl3kK6ijoeP1IRsvY6323mHUZFJMgTvxaG2iE.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
#Bar{
  width:2500em;
  height:5em;
  background-color:black;
  text-align:right;
  display: table-cell;
  vertical-align: bottom;
  padding:0;
}
#Logo{
  width:6%;
  height:auto;
  float:left;
  padding-left:11em;
  padding-bottom:0em;
  padding-top:1em;
}
#Menu{
  width:2500em;
  height:auto;
  background-color:#0e1f5a;
  text-align:center;
  display: table-cell;
  vertical-align: bottom;
  padding:0.5em;
  font-size:1.2em;
  font-family:Lato;
}


.DJHover { position: relative;opacity: 0.7; width: .4em; height: 1.3em;}
.DJHover .caption5 {opacity:0 ; position: absolute; height:1.3em; width: .4em;bottom: 0;left: 0;padding: 1.175em 0;-webkit-transition: 3s ease-in-out; -moz-transition: .3s ease-in-out;
    -o-transition: 3s ease-in-out;
transition: 3s ease-in-out;}
.DJHover:hover .caption5 { opacity: 0.7;width: 5.4em; height: 1.3em;font-size:5em;color: White; background: black; text-align: center; font-weight:bold;-moz-transform: translate(0em,0);-webkit-transform: translate(0em,0);
-o-transform: translate(0em,0);
-ms-transform: translate(0em,0);
transform: translate(0em,0);
;}


#Footer{
  width:2500em;
  height:5em;
  background-color:#0e1f5a;
  text-align:left;
  display: table-row;
  vertical-align: bottom;
  padding:0.5em;
  font-size:1em;
  font-family:Lato;
  color:white;
  
}

#ContactButton{
  border:0.0625em solid white;
  background-color:black;
  padding-left:2.5em;
  padding-right:2.5em;
  
}
#Bar2{
  width:2500em;
  height:3em;
  background-color:black;
  text-align:right;
  display: table-cell;
  vertical-align: bottom;
  padding:0;
}
<!DOCTYPE html>
<html>
  <head>
    <title>Home </title>
    <link type="text/css" rel="stylesheet" href="file:///home/chronos/u-cba4e7cda58d8e8812f74a8c51a34fa154676b3f/Downloads/M1/StyleSheet3.css"/>
  </head>
  <body style="background-color:black">
    <div id="Bar">
      <a href=""/></a>
    </div>
    <br>
    <div id="Menu">
  <a style="margin-right:2em" href="file:///home/chronos/u-cba4e7cda58d8e8812f74a8c51a34fa154676b3f/Downloads/M1/Home.html"> Home </a>
  
  <a style="margin-right:2em" href="file:///home/chronos/u-cba4e7cda58d8e8812f74a8c51a34fa154676b3f/Downloads/M1/DJs.html">DJs</a>
  </div>
  <center>
     <br><br><br>
        <a class="DJHover" href="file:///home/chronos/u-cba4e7cda58d8e8812f74a8c51a34fa154676b3f/Downloads/M1/DJs.html">
          <img style="width:27em" src="http://www.dancefair.tv/wp-content/uploads/2015/05/How-to-secure-DJ-gig.jpg"/>
          <div class="caption5"><br>DJS</div>
        </a>
   </center>
   <br><br><br>
   <div id="Footer">
     <table style="padding-left:20%;padding-right:5%">
       <tr>
         <td>
           <a href=""><div id="ContactButton"><p>Contact</p></div></a>
         </td>
         <td>
           <a href=""></a>
         </td>
         <td>
           <p style="margin-left:5em"><strong>TEL</strong></p>
           <p style="margin-left:5em"><strong>ADDRESS</strong></p>
         </td>
         <td>
           <p style="margin-left:5em">&#169;2015 by <a href="" style="text-decoration:underline;color:Red"></a>.</p>
         </td>
       </tr>
     </table>
    
   </div>
   <div id="Bar2"></div>
     
      
  </body>
</html>

Answer №1

Instead of simply sliding up and to the right, your translucent overlay is actually expanding from width: .4em; to width: 5.4em; - it appears to be the result of a potential typo.

There seem to be other unintentional errors in your styles as well.

For example:

-webkit-transition: 3s ease-in-out; -moz-transition: .3s ease-in-out;

I've attempted to recreate what I believe you are aiming for below:

body {
margin: 0;
padding: 0;
background-color: rgb(0,0,0);
}

.DJHover, .DJHover img, .DJHover .caption5 {
display: inline-block;
top: 100px;
left: 200px;
width: 432px;
height: 264px;
overflow: hidden;
}

.DJHover {
position: relative;
color: rgb(255,255,255);
text-decoration: none;
opacity: 0.7;
}

.DJHover .caption5 {
position: absolute;
top: 0;
left: 0;
font-size: 5em;
font-weight:bold;
text-align: center;
opacity: 0;

-webkit-transform:translate(-100%,0);
-moz-transform:translate(-100%,0);
-o-transform:translate(-100%,0);
-ms-transform:translate(-100%,0);
transform:translate(-100%,0);

-webkit-transition: 3s ease-in-out;
-moz-transition: .3s ease-in-out;
-o-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}

.DJHover:hover .caption5 {
color: rgb(255,255,255);
background-color: rgb(0,0,0);
opacity: 0.7;

-moz-transform: translate(0,0);
-webkit-transform: translate(0,0);
-o-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0);
}
<a class="DJHover">
<img src="http://www.dancefair.tv/wp-content/uploads/2015/05/How-to-secure-DJ-gig.jpg" />
<div class="caption5"><br />DJS</div>
</a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When submitting a form with a contenteditable div and text box using JQuery, the POST request is not

I developed a website that allows users to edit and format text, then save it onto the server. Utilizing jquery to send the data to a PHP page for saving, I encountered an issue where the site fails to send the file name along with the formatted text to PH ...

Is there a way to stop jQuery dragging functionality from causing the page to scroll unnecessarily

Whenever I drag an element from div1 to div2, the scrollbar in div1 keeps extending until I drop the element in div2. How can I prevent this extension without breaking the element being dragged? <div class="container-fluid"> <div class="row"> ...

Setting up the foundation for a Bootstrap footer: A step-by-step guide

I've been struggling to implement the HTML5 structure within Bootstrap 4 grid system to match the design shown in the attached images. The layout should resemble the top image when viewed on a phone, phablet, or tablet in portrait mode, and the bottom ...

Attempting to showcase the information in my customized SharePoint Online list through a Web Part Page utilizing AngularJS

<script> //AngularJS Code goes here var appVar = angular.module('listApp', ['ngRoute']); appVar.controller("controller1", function($scope){}); function FetchEmployeeData($scope, EmployeeList){ var reque ...

Creating uniform-sized cards with CSS and Bootstrap

Is there a way to ensure consistent card size across all lines? I've noticed that the cards in the second line are taller. Can we base the height of all cards on this? https://i.sstatic.net/KgZwu.png Below is the HTML code: <div class="row"&g ...

The absence of PHP GET variable being set

I am encountering an issue with my registration php class. It is designed to display a form and upon clicking the registration button, it triggers a function in a login javascript file. This JavaScript file utilizes ajax to send data to an index.php file. ...

Issues with displaying or hiding a DIV using javascript - popup box unresponsive

I am working with this ASPX code: <div id="IsAccountingOk" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a><br /> <asp:Label ID="lblIsAccountingOkHeader" runat="server" Text ...

Creating an invoice or money receipt using HTML is a straightforward process that involves using specific code and

Currently, I'm in the process of developing an application for a land developer company. The administrator of this application will be responsible for creating invoices, money receipts, and bills. I am looking to design these documents to resemble th ...

Immediate family members nearby are not an option. We will have to create the form dynamically

On a previous page, there is a form that allows users to input data and define the number of "Attributes" they want to assign to a device by clicking on a button. Users are prompted to specify a name and type for each attribute. If the user selects "Selec ...

Can you please tell me the name of this specific graph? And could you explain how I can recreate it on a

I am fully aware that this information is just a Google search away. However, I am unsure of the specific name of the chart I am seeking. Therefore, I am unable to conduct an effective search for suitable plugins or APIs. Your understanding is greatly appr ...

Is it possible to create a button function in HTML that can alter the CSS image tag?

Is there a way I could create a function that can retrieve a value, update an image source, and then incrementally select another value? It would be incredibly helpful if you could provide a reference where I could learn how to do this or explain it in det ...

Is there a way to eliminate the transform style from a draggable element?

I am looking to enhance the CDK drag and drop example by adding a preview of the dragged element with specific left and top positions, without utilizing the transform style. HTML <div class="example-boundary"> <div class="example- ...

Arranging Cards in Layers on Smaller Screens Using Bootstrap Framework

My row of cards in various sizes looks good on larger screens like this: https://i.sstatic.net/1qF53.png However, on smaller screens, the cards lose their appeal. https://i.sstatic.net/o1NS8.png To improve this, I want to stack the cards so that the ke ...

Python tutorial: Executing onclick values with a click

I'm currently working on writing some Selenium Python code and I have a question. The website I am testing has multiple time slots available, and I am attempting to simulate a mouse click specifically geared towards the 8:30-11:30 timeslot. Below is ...

Identifying clicks on various indices within a common class or element

My website has a navigation menu with unordered list items in it. <nav> <ul> <li id="zero"></li> <li id="one"></li> <li id="two"></li> </ul> </nav> I am working on implementing J ...

IE8 is not properly handling nested HTML elements that have the display:none property set

I am currently using jQuery to create a smooth fade-in effect for an <article> element that contains a <section> element. The outer element has CSS properties of display:none, position:fixed, and z-index:5. Meanwhile, the inner element is styl ...

Links have a longer transition delay compared to the content

In a unique JavaScript function I've developed, the my-content-section-visible class is removed and replaced with my-content-section-hidden. This change is being made to hide a particular div using a smooth transition effect. The transition itself is ...

Having trouble getting $compile to work in an injected cshtml file with Angular

Summary I am currently working on a large application where everything is designed to be very generic for easy expansion. One of the components I am focusing on is the dialog. Before suggesting alternatives like using ngInclude or angular templates, let m ...

Proper alignment of multiple elements with Bootstrap

I am currently incorporating Bootstrap panels into my project, and I have a design mockup that looks like this: The Profile text and progress bar need to be aligned to the left, while the collapse icon should be aligned to the right. Here is the code sni ...

Could someone please clarify a specific aspect of how floats work?

Could someone simplify this explanation for me? A float is positioned next to a line box if there is a vertical space that meets these conditions: (a) at or below the top of the line box, (b) at or above the bottom of the line box, (c) below the top margi ...