Incorporating a fade-in effect on a navigation data sprite

Help needed with creating a fade-in effect for sprite buttons in my navigation menu. I want the timing to match the icons at the bottom of my website, but I'm struggling to apply it. Currently, the navigation buttons change instantly or have a slide effect, which is not my desired outcome. I want the effect only in CSS. Can anyone provide assistance?

Website: www.thestripedphoenix.com

#navigation {
  position: relative;
  margin-top: 10px;
  margin-left: 800px;
  max-width: 600px;
  min-width: 520px;
  height: 50px;
  float: right;
  overflow: hidden;
}
#nav {
  position: relative;
  right: 0.5em;
  height: 49px;
  line-height: 3em;
  border: 3px solid #232323;
}
#nav dl {
  margin: 0;
  padding: 0;
}
#nav dt {
  float: left;
}
#nav dt a {
  display: block;
  height: 0px !important;
  padding: 100px 0 0 0;
  overflow: hidden;
  background-repeat: no-repeat;
}
#nav dt a:hover {
  background: 0 -50px;
}
#nav dt a:active {
  background-position: 0 -50px;
}
#nav dt a:visited {
  background-position: 0 -50px;
}
#nav dt#start, #nav dt#start a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/intro.gif");
}
#nav dt#about, #nav dt#about a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/about.gif");
}
#nav dt#skills, #nav dt#skills a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/skills.gif");
}
#nav dt#portfolio, #nav dt#portfolio a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/portfolio.gif");
}
#nav dt#message, #nav dt#message a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/contact.gif");
}
<div id="navigation">
  <nav id="nav">
    <dl>
      <dt id="start"><a href="#intro">intro</a><span></span></dt>
      <dt id="about"><a href="#one">about</a></dt>
      <dt id="skills"><a href="#two">skills</a></dt>
      <dt id="portfolio"><a href="#work">portfolio</a></dt>
      <dt id="message"><a href="#contact">contact</a></dt>
    </dl>
  </nav>
</div>

Answer №1

You have already set the same background images for #nav dt and #nav dt a. To complete the task, adjust the opacity of a to 0 and return it to 1 on hover, while adding a transition for animation. Icons at the bottom of the page have a 0.2-second animation, while menu buttons have a 0.25-second animation.

#navigation {
  position: relevant;
  margin-top: 10px;
  margin-left: 800px;
  max-width: 600px;
  min-width: 520px;
  height: 50px;
  float: right;
  overflow: hidden;
  background-color: #232323;
}
#nav {
  position: relevant;
  right: 0.5em;
  height: 49px;
  line-height: 3em;
  border: 3px solid #232323;
}
#nav dl {
  margin: 0;
  padding: 0;
}
#nav dt {
  float: left;
}
#nav dt a {
  display: block;
  height: 0px !important;
  padding: 100px 0 0 0;
  overflow: hidden;
  background-repeat: no-repeat;
  transition: all 0.25s;
}
#nav dt a:active {
  background-position: 0 -50px;
}
#nav dt a:visited {
  background-position: 0 -50px;
}
#nav dt#start, #nav dt#start a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/intro.gif");
}
#nav dt#about, #nav dt#about a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/about.gif");
}
#nav dt#skills, #nav dt#skills a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/skills.gif");
}
#nav dt#portfolio, #nav dt#portfolio a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/portfolio.gif");
}
#nav dt#message, #nav dt#message a {
  width: 100px;
  background-image: url("http://www.thestripedphoenix.com/images/contact.gif");
}
#nav dt a {
  background: 0 -50px;
  opacity: 0;
}
#nav dt a:hover {
  opacity: 1;
}
<div id="navigation">
  <nav id="nav">
    <dl>
      <dt id="start"><a href="#intro">intro</a></dt>
      <dt id="about"><a href="#one">about</a></dt>
      <dt id="skills"><a href="#two">skills</a></dt>
      <dt id="portfolio"><a href="#work">portfolio</a></dt>
      <dt id="message"><a href="#contact">contact</a></dt>
    </dl>
  </nav>
</div>

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

Customizing Mat Horizontal Stepper Icons with Unique Background Colors in Angular Material

I'm having trouble customizing the colors of the icons In my mat-horizontal-stepper, I have five mat-steps (Part A, Part B ... Part E), each needing a different color based on certain business rules. While I can change the color for all steps or the ...

jQuery mobile enhancing user experience with dynamic background images

I am having trouble setting different background images for each page in jQuery Mobile. <div data-role="page" id="pageone">... </div> <div data-role="page" id="pagetwo">... </div> Since each page has a unique ID, I tried ...

Is it possible to insert an image as the background of a specific word within a paragraph?

I am looking to enhance certain words in a paragraph by adding a brushstroke image in the background, similar to this example: https://i.sstatic.net/KzjGn.png. I attempted to use a simple background for a span, but the image exceeded the padding and was cu ...

Obtain span value using a CSS selector in Python

I need help extracting the value of a span using a CSS selector soup = BeautifulSoup("<body><main><div class='rentalprice'><span>3.000</span></div></main></body>") pagecontent = soup.find( ...

The bootstrap select dropdown seems to have a mind of its own and doesn't want to

While using the bootstrap-select picker to select an option, I encountered an issue where the drop-down structure with the top bar does not properly follow the parent element when the container is scrolled. If you want to see the issue in action, please c ...

Switching between div elements in ReactJS

I am currently working on a web application built with ReactJS. One feature that I would like to include is similar to the following: https://i.sstatic.net/At1Gw.gif My query is as follows: What is this specific effect called? How can I go about imple ...

Opting for a CSS framework instead of building custom CSS from scratch

In my quest to achieve the best CSS practices on my website, I initially relied on my own custom CSS. However, I then discovered the option of using CSS frameworks like Bootstrap or Foundation Zurb. While I believed that using a framework alone would meet ...

Tornadofx highlight selected row with CSS

I am attempting to modify the background color of a selected row and apply the same change to a listview. When I use cell{backgroundColor += Color.BLACK}, it successfully changes the color, but it does not retain the selection color as intended.I have al ...

The Material UI dialog box popped up against an unexpected gray backdrop

Currently, I am using Material UI in conjunction with React to create a dialog that appears when a button is tapped. This button is located within a table, which is displayed over a Paper component. The problem arises when I utilize the dialog with its def ...

Guide on transferring the td id value to a different page

document.getElementById('scdiv').innerHTML=Quantity <td id="scdiv"> </td> document.getElementById('quantitydiv').innerHTML=mrp <td id="quantitydiv"> </td> I am currently facing an issue where the code is being d ...

What is causing the failure of these "span" elements within an "a" tag in IE7?

Here is a code snippet that I am working with: HTML (version 4.0) <div class="temperatura"> <a href="/link/" class="temperatura_localita"> <span style="padding-left:12px;"> T ...

Step-by-step guide on transitioning code to utilize @use instead of @import

Currently, I am in the process of revamping a clubs app from Angular 9 to 18, as it has not been well maintained. My goal is to preserve as much of the frontend as possible and maintain the design more or less the same. Within the code, I have identified ...

implementing a smooth transition effect for image changes upon hover

I've been working on a React project where I created a card that changes its image when hovered over. I wanted to add a smoother transition effect to the image change using transition: opacity 0.25s ease-in-out;, but it doesn't seem to be working ...

Positioning the jQuery mobile navBar to be fixed on iOS 4 devices

Currently working on a mobile app with jquery using iOS4 and iOS5 compatibility as the final hurdle. While fixing the navigation bar is simple on iOS5 with position:fixed, it's not as straightforward on iOS4! I've experimented with various soluti ...

Troubles encountered when loading pages into a div using ajax navigation

As someone new to the world of programming, I am embarking on the journey of creating a simple website for myself. Currently, my website consists of a header, navigation links, an image below the nav (to be updated later), and 3 content divs beneath that. ...

Safari causing placeholders to be sliced

I'm having trouble creating attractive placeholders in Safari. This is how it currently appears. Codepen: https://codepen.io/anon/pen/RLWrrK https://i.sstatic.net/aChBs.png .form-control { height: 45px; padding: 15px; font-size: 16px; col ...

The Google calendar integration is working, but the appearance leaves much to

I embedded a Google calendar, but I'm having trouble centering it on the page without it overflowing onto the top menu. Can you help me fix this issue? If you'd like to see what I'm referring to, you can visit this link: ...

CSS vertical alignment: Getting it just right

I am currently using Bootstrap and below is a snippet of the code I have implemented. <div class="row"> <div class="col-lg-6"><img src="#" alt=""></div> <div class="col-lg-6"> <h2>Heading</h2> ...

Div content with a unique angle

I need to create a website with slanted div elements that must meet the following criteria: The sections should have a height of approximately 400px when displayed side by side, and about 800px when they stack vertically. It would be ideal if this could ...

Creating a Distinctive HTML Structure with Div Percentage (HTML 4)

I am new to web design and have a unique approach; I believe in the importance of flexibility. It puzzles me why pixels (px) are commonly used instead of percentages, maybe my perspective is misunderstood. I've been on the hunt for a basic HTML layo ...