Unable to implement a transition to adjust the scaling transformation

As I work on developing a website for a local business, my progress involves creating a menu bar. However, I am facing an issue with the transition I have applied using transform: scale(1.2) which does not seem to be working as intended. After spending hours looking for a solution, I am yet to find one. While reviewing my code, everything seems correct and should be functioning smoothly, but the transition is not being applied. If I attempt to resize the list item on hover without using transform, it ends up shifting the other elements around it, resulting in an unattractive appearance. The menu is currently displayed at full size and is not responsive, hence not optimized for smaller screens. Below is the code snippet:

 <!DOCTYPE html>
  <html>
   <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <title>
      Pacific Cay
     </title>
    <link rel="stylesheet" type="text/css" href="style.css"/>
   </head>
  <body>
   <div class="container">
    <div class="menu">
     <ul>
      <a href="#"><li class="about2">About Us</li></a>
       <a href="#"><li>About Us</li></a>
     <a href="home.html"><li id="logobox"><span id="hiddenoverlay">About us.
     </span></li></a>
    <a href="#"><li>About Us</li></a>
    <a href="#"><li class="about">About Us</li></a>
   </ul>

  </div>
</div>
</body>
</html>



body
{
 background-image: url("banner.jpg");
 background-repeat: no-repeat;
 background-size: cover;
}

ul 
{
 list-style: none;
 padding: 5px;
 margin: 0px;
 padding-left: 3.3em;
 padding-top: 2em;
}

ul li 
 {
 margin-left: 0.7em;
 font-size: 55px;
 display: block;
 position: relative;
 float: left;
 border-top: 5px outset #3333ff;
 border-bottom: 5px outset #3333ff;
 border-radius: 20px;
}

li ul 
{
 display: none;
}

ul a li 
{
 display: block;
 padding: 5px 10px 5px 10px;
 text-decoration: none;
 white-space: nowrap;color: #fff;
 transition: transform 1s;
 transition: background-color 0.5s;
 transition: box-shadow 0.5s;
 box-shadow: 0px 0px 0px 0px #000000;
}

ul a li:hover 
{
 transform: scale(1.2);
 box-shadow: 0px 10px 20px 0px #000000;
 background: #c0c0c0;
}

li:hover ul 
{
 display: block; 
 position: absolute;
}

li:hover li 
{
 float: none;
}

a:hover li 
{
 background: #f00;
}

li:hover a li:hover 
{
 background: #000;
}

#drop-nav li ul li 
{
 border-top: 0px;
}

.menu 
{
 position: absolute;
 background: #7777ff;
 width: 100%;
 top: 0;
 left: 0;
 height: 10em;
 border-bottom: 1px outset #3333ff;
}

#logobox
{
 background-image: url("logo.png");
 height: 1.7em;
 background-repeat: no-repeat;
 margin-top: -0.3em;
 font-size: 60px;
}

#hiddenoverlay
{
 opacity: 0;
}

.about2
{
 margin-left: -0.7em;
}

Here is a link to view the code: https://jsfiddle.net/0k62nz1w/

Answer №1

You can specify multiple transitions by separating them with commas in a single transition. Check out this example: https://jsfiddle.net/0k62nz1w/1/

body {
  background-image: url("banner.jpg");
  background-repeat: no-repeat;
  background-size: cover;
}

ul {
  list-style: none;
  padding: 5px;
  margin: 0px;
  padding-left: 3.3em;
  padding-top: 2em;
}

ul li {
  margin-left: 0.7em;
  font-size: 55px;
  display: block;
  position: relative;
  float: left;
  border-top: 5px outset #3333ff;
  border-bottom: 5px outset #3333ff;
  border-radius: 20px;
}

li ul {
  display: none;
}

ul a li {
  display: block;
  padding: 5px 10px 5px 10px;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  transition: transform 1s, background-color 0.5s, box-shadow 0.5s;
  box-shadow: 0px 0px 0px 0px #000000;
}

ul a li:hover {
  transform: scale(1.2);
  box-shadow: 0px 10px 20px 0px #000000;
  background: #c0c0c0;
}

li:hover ul {
  display: block;
  position: absolute;
}

li:hover li {
  float: none;
}

a:hover li {
  background: #f00;
}

li:hover a li:hover {
  background: #000;
}

#drop-nav li ul li {
  border-top: 0px;
}

.menu {
  position: absolute;
  background: #7777ff;
  width: 100%;
  top: 0;
  left: 0;
  height: 10em;
  border-bottom: 1px outset #3333ff;
}

#logobox {
  background-image: url("logo.png");
  height: 1.7em;
  background-repeat: no-repeat;
  margin-top: -0.3em;
  font-size: 60px;
}

#hiddenoverlay {
  opacity: 0;
}

.about2 {
  margin-left: -0.7em;
}
<!DOCTYPE html>
<html>

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>
      Pacific Cay
    </title>
    <link rel="stylesheet" type="text/css" href="style.css" />
  </head>

  <body>
    <div class="container">
      <div class="menu">
        <ul>
          <a href="#">
            <li class="about2">About Us</li>
          </a>
          <a href="#">
            <li>About Us</li>
          </a>
          <a href="home.html">
            <li id="logobox"><span id="hiddenoverlay">About us.</span></li>
          </a>
          <a href="#">
            <li>About Us</li>
          </a>
          <a href="#">
            <li class="about">About Us</li>
          </a>
        </ul>

      </div>
    </div>
  </body>

</html>

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

Ensuring only one group is open at a time in jQuery when a new group is opened

I need assistance in getting this functionality to work properly. My goal is to have only the clicked group open, while closing all others that are currently open. Here's a specific example of what I am trying to achieve: var accordionsMenu = $(&apo ...

Button background must be grayscale, while the text should remain unaffected

I have a variety of buttons with different background images. My goal is to apply a grayscale filter to the backgrounds by default and remove the filter on hover, without affecting the color of the button text. Currently, when I apply the grayscale filter ...

Hovering over a td tag and adding a border using CSS can cause the entire table to

While experimenting on a coding platform: <table> <tr> <td class="changeme">something</td> <td>something</td> <td>something</td> <td>something</td> < ...

Having trouble submitting a date input form generated with vuejs on Safari browser

I am a huge fan of Vuejs and it's my go-to at work. The other day, I came across a rather perplexing scenario. If you have any insights into this, please do share. Here is the code in question: <script setup lang="ts"> import { ref ...

Showing a text value from a Github Gist on a Hugo website

I seem to be struggling with a seemingly simple task and I can't figure out what I'm missing. Any assistance would be greatly appreciated. I am working on generating a static site using Hugo. On one of my pages, I want to implement a progress ba ...

Utilize Flexbox to create a layout with 3 divs, organized into two columns where one column

I am attempting to transform <div></div> <div></div> <div></div> Three consecutive divs into the following format. Div 1 is red, div 2 is green, and div 3 is blue. I have achieved this using floats, like so: .div1 { ...

The CSS Grid container fails to resize based on the content inside

I am facing an issue with the grid element inside a parent container with display: grid;. The parent container has a maximum size and allows scrolling for the grid if necessary. The problem is that the grid element does not expand to fit its children. Whe ...

Achieving True Nested Divs: Making Children Truly Inside

I want to create nested divs for positioning children with top and left properties, allowing them to overlap each other: https://jsfiddle.net/e0cpuarv/ .boo { position: absolute; left: 10px; top: 10px; width: 100px ...

On-page refresh triggering HTTP 404 error in Vue3 routing situation

Issue Upon reloading a route, such as /installer, in Vue3.js, I encounter the following error: Code Snippet I am utilizing the Router with the setup below: const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes, }); E ...

What is the process for making the default text in a text box appear grayed out?

Hey there! I have this cool idea for a text box. Basically, it starts off with default text but when you hover your mouse over it, the text disappears and you can start typing as usual: If you want to see how it looks like, you can check out this link: N ...

Ways to Randomly Flip Divs

I have developed an application where all divs flip vertically on hover. I am looking for a way to make the flipping random without requiring a hover. Any ideas on how to achieve this? .vertical.flip-container { position: relative; float: left; ma ...

Add navigation dots to the slider in order to align them with the specified div element

Visit this JSFiddle link for the code <html> <link href="./style.css" rel="stylesheet" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script&g ...

Updating dynamic content in IBM Worklight V6.1 with jQuery Mobile v1.4.3 requires waiting for the DOM to load

I need to dynamically update the content of a div within my HTML page structure. <!DOCTYPE HTML> <html> ... <body> <div data-role="page"> <div data-role="header"> //Image </div> <!-- Th ...

React Fixed Footer Implementation against My Preferences

Here's an issue that I'm facing: https://i.stack.imgur.com/gtQqm.png The footer on my webpage is normally displayed at the bottom of the page. However, when the user performs certain actions that extend the size of the page: https://i.stack.im ...

Troubleshooting: Ineffective use of replace() function on input value with jQuery

Visit this link for a demo How can I update the input value based on user selection in a dropdown menu? The objective is to change the value from "service_######" to "membership##_####" when the user selects YES, but my current JavaScript code using repla ...

What is causing my background div to jerk around when I implement jQuery animate to adjust its height?

UPDATE: I have replicated my issue in jsFiddle: http://jsfiddle.net/leongaban/3v8vW/3/ I am dealing with 2 tabs - one should reduce the height of the form-background when clicked, while the other should increase it. I want a smooth animation without any a ...

Having trouble with Firefox not displaying the image source with an absolute path

ASP.NET Application I am experiencing some confusion with displaying images. While Internet Explorer shows the images correctly, Firefox is not showing them on the production server. The image url generated on the server is: \chartings\charts& ...

showing database table contents on a website page

What is the best way to retrieve data from a MySQL database that corresponds to user input on a web page, and then showcase the content without having to reload the page using PHP or another suitable language? I would greatly appreciate any assistance wi ...

Ways to guarantee that only one accordion tab is open at a time while keeping it open continuously

Hey everyone, I'm just starting to learn how to code and still getting the hang of using Stack Overflow so please bear with me if my question isn't perfectly formatted. I have created an accordion that is almost functioning correctly, but I need ...

Beginning the phone application using either HTML5 or Cordova

Is there a way to use either HTML5 or Cordova (PhoneGap) to initiate a call to a phone number? I am looking to create a button that says "Call 555-555-5555", and when clicked, it opens the phone app on the device with that specific number. ...