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

The height of the ReactPlayer dynamically adjusts to accommodate content beyond the boundaries of the page

I have a video on my webpage that I want to take up the entire screen, but currently, users have to scroll a bit to reach the bottom, which is not ideal. This is my JavaScript: <div id="page"> <div id="video-container"> ...

Is there a way to retrieve all "a" tags with an "href" attribute that contains the term "youtube"?

My goal is to capture all a tags that have the href attribute containing the word youtube. This task requires the use of jquery. ...

JQueryMobile 1.3.2 encounters issues with popups following the installation of Chrome version 43.0.2357.65 m update

Is anyone else experiencing issues with the latest version of Chrome "43.0.2357.65 m" causing problems with JQueryMobile 1.3.2? When I try to click on a popup, it suddenly jumps to the top of the page and the scroll bar disappears. This was not an issue in ...

Select a specific element to apply a CSS selector for a button

One of the challenges I am facing involves a webpage with multiple submit buttons. My goal is to iterate through each button and click on them one by one. While I am aware that this can be achieved using xpath like this (//button[@class='submit' ...

Managing active dropdown menus in VueJS

I'm having trouble figuring out why my navigation menu and method to open subitems on click are not working correctly. [![dropdown_menu][1]][1] new Vue({ el: '#app', data: { //menu "menu_title": "a", "child_ro ...

Tips for deleting part of the URL at the end of all hyperlinks on a webpage

I have a large number of links on the same page that I would like to clean up by removing everything from specific characters until the end of the URL. Currently, there are too many links like this scattered throughout my page. The string "$amp;rs" or "&a ...

Use CSS properties to isolate and extract the logo from the Sprite image

If we have a sprite image, like the StackOverflow sprite, and CSS properties like: background-position: 0px 0px; width: 250px; height: 61px; We can use the Chunky PNG library to crop out a specific part of the sprite. However, some websites use negative ...

As soon as I hit the submit button on my website form, the URL is automatically refreshed with the information I provided

I am a beginner when it comes to forms and recently copied and pasted this login snippet code: <div class="login-form-1"> <form id="login-form" class="text-left"> <div class="main-login-form"> <div class="login-group"> ...

Enhancing the appearance of multiple images with CSS and Bootstrap styling

I am struggling to arrange multiple images in my booking system as they are all displaying in a single column rather than the desired layout What I had hoped for was a layout like this Currently, I am using bootstrap to format the images. My goal is to i ...

Using Ajax, the script triggers calls upon detecting keyup events on various input fields, each

I'm encountering issues while attempting to solve this logic puzzle. The page contains multiple fields and the goal is to store the input values in the database when the user finishes typing. Here's the code snippet: var debounce = null; ...

Assign a CSS class to a specific option within a SelectField in a WTForms form

Could someone explain the process of assigning a CSS class to the choices values? I am looking to customize the background of each choice with a small image. How can this be done using wtforms and CSS? class RegisterForm(Form): username = TextField( ...

Using JavaScript (without jQuery), take away the CSS class from an element

Seeking assistance from experts on the process of removing a class from an element solely using JavaScript. Kindly refrain from suggesting solutions involving jQuery as I am unable to utilize it, and have little knowledge about its functionalities. ...

Using the CSS property `transform:scale(2,2)` causes an image to suddenly appear in the

Currently utilizing Joomla 3.3, I am seeking to enlarge an image on mouseover. The html code for the image is as follows: <img class="enlarge" style="float: right; margin: 10px; border: 5px solid black;" title="Chapter 1: Physical Differences" src="im ...

Adding multiple lines of text using jQuery

I am facing an issue while trying to append a string to an HTML element. It works perfectly fine with a single line string, but breaks when I try to split it into multiple lines. <div><h4 >List to do:</h4><span id="added"></span ...

What is the superior choice for PHP scripts that are suitable for real-world projects?

While delving into the world of PHP, I am curious about the best approach for inserting HTML tags within a PHP script. Is it better to use PHP echo statements or to break the PHP script to incorporate HTML with the help of opening and closing PHP tags? B ...

Unable to submit form within a while loop in PHP table

After making some changes to my form, I noticed that only the hidden input field is being submitted when I try to submit the form. It's strange because it was working perfectly fine before. while ($row = mysqli_fetch_array($gettimesheets)) { $dat ...

How to access a shadowroot element using R Selenium

Currently, I'm dealing with web scraping where one of the websites presents a 'Accept cookies' button within a shadow root. To address this issue, I sought assistance on how to click this button in discussions found here: Click on accept co ...

Why Isn't AJAX Displaying the Output from PHP?

Currently, I am implementing ajax to display a string received from a php file. This particular php file is generating rows for an html table. My goal is to have ajax place these rows within a with a specific id that resides inside a and I want this oper ...

Is there a CSS rule that can alter the appearance of links once they have been clicked on a different webpage?

Just starting out here. Imagine I have 4 distinct links leading to the same webpage - is there a way to modify the properties of the destination page depending on which link was clicked? For instance, clicking on link1 changes the background color of the d ...

Retrieve detailed Paypal donation transaction information in HTML format with the donation button functionality integrated

I'm currently in the process of building a web application for a non-profit organization, which includes a Paypal Donation feature. I am using HTML5, CSS3, and jQuery to develop this application. I have successfully implemented the Donation button fro ...