Is there a problem with the -webkit-transition property not functioning properly within a bubble element?

As I was developing my portfolio, I had an idea to add a unique hover effect. I wanted a bubble with an arrow to appear when someone hovers over my name. While I managed to create the basic functionality, I encountered an issue with the -webkit-transition property not working as intended. The positioning of the bubble also seemed off, prompting me to adjust its hiding time for better accessibility. Considering adding a contact form within the bubble, I needed it to be easily accessible.

Here's a snippet of my HTML:

<div id="side-bar">
  <h1 id="ab_me">About Me</h1>
  <img src="saksham.png" id="saksham">
  <p id="name"><span>S</span>aksham <span>C</span>hauhan</p>

  <div id="bubble">
    SUP!
    <div id="bubble-arrow-border">
    </div>
    <div id="bubble-arrow">
    </div>
  </div>
</div>

Additionally, here is some CSS I used:

div#side-bar p {
  font-size: 25px;
  border-bottom: 2px solid red;
  position: absolute;
  left: 10px;
  color: #F63737;
}
div#side-bar p:hover {
  border-bottom: 2px groove #C01F1F;
  color: #C01F1F;
  text-shadow: 0px 1px 2px #F98378;
  -webkit-transition: 1s;
}
/* additional CSS rules go here */

Answer №1

It is important to set both the "before" and "after" states when using a transition. For example, you cannot transition from nothing to opacity:0, but you can transition from opacity:1 to opacity:0. Additionally, transitions are not supported on the display property, but they work with the visibility property.

To learn more about CSS transitions, check out this link: https://developer.mozilla.org/en-US/docs/CSS/Tutorials/Using_CSS_transitions

Answer №2

Specify the properties that you want to transition. A suggested approach would be:

transition:all 1s ease;
-webkit-transition:all 1s ease;

Answer №3

Share only the relevant parts of your code, not the entire thing.

Using CSS transitions alongside display:none can be tricky. In my experience, I found it necessary to use Javascript in addition to CSS when working with display:none.

Instead of using display:none on #bubble, try removing it and adding:

-webkit-transition:all 1000ms;

To the #bubble selector, along with setting #bubble:hover to change opacity to 1:

opacity:1;

This will create a fading effect for your bubble, transitioning from visible to transparent and back.

http://jsfiddle.net/charlescarver/nrTMg/1/

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 component next/image is experiencing issues when used in conjunction with CSS

I struggled to create a border around an image because the custom CSS I wrote was being overridden by the Image component's CSS. Despite trying to leverage Tailwind and Bootstrap to solve the problem, my efforts were unsuccessful. Now, I am at a loss ...

The Angular service encounters issues when interacting with REST API

Within my application, a template is utilized: <div class="skills-filter-input" ng-class="{'hidden-xs': skillsFilterHidden}"> <input type="text" ng-model="skillQuery" ng-change="filterSkills()" placeholder="Filter skills" class="filter- ...

Exploring Data in ASP.NET Resource Files

I currently have an HTML file located in Resource1.resx. My goal is to retrieve the content of this HTML file using a StreamReader. What steps should I take to achieve this? Here is the HTML file content: <html> <body> <table> < ...

What could be causing the issue with this flexbox footer not functioning properly on a mobile device?

Currently, I am honing my skills in using flexbox to create footers. Although the footer layout I have designed looks great on a desktop screen, it unfortunately doesn't display correctly on mobile devices. You can view the footer layout I have been ...

Finding the identifier of a dynamically generated text input using PHP

I am looking to create a page similar to this On this page, users can add multiple entries for date, site, start time, end time, and hours amount by clicking the + button, and remove entries using the - button. How can I retrieve the input values in PHP? ...

Is there a way to create an input field that accepts only numbers and behaves like a password field simultaneously?

I am attempting to develop an input field for entering a PIN. I would like the PIN to be masked on mobile devices, similar to how passwords are obscured in password input fields. I came across a suggestion on stackoverflow regarding this, but unfortunately ...

React navigation NavLink problem

After searching and attempting various solutions, I am still facing an issue with toggling the active className for a NavLink in my react-router-dom setup. Below is the code snippet: import React from 'react' import styles from './NavBar.mod ...

I seem to be having trouble locating the element using its xpath

I am in search of the xpath element below. What would be the xpath? precise location (GPS and network-based) Below is the HTML code: <div class="permission-bucket" jsinstance="1" jstcache="75"> <div class="bucket-icon-and-title" jstcache="87"&g ...

Avoid page refreshing when retrieving data using PHP and AJAX

In my current program, I am able to add data and insert it into the database. However, I am looking for a way to automatically send this data to another page or browser without refreshing. I have two browsers open, so how can I submit the data to the other ...

Get rid of the border when the display property is changed to none

I am facing a challenge with removing a border when the display property is set to none, despite it being a seemingly simple task. My understanding has always been that setting the display property to none removes an element from the HTML flow. However, i ...

Having trouble with getting the second JavaScript function to function properly?

I am facing an issue with the second JavaScript function. When I click the 'Send Mail' button, it should call the second function and pass it two values. However, the href line (second last line in the first function) is not rendering correctly. ...

What is the best way to use jQuery to position a <div> at the bottom of another <div>?

Is there a way to achieve something similar to this concept? https://i.sstatic.net/xhewF.png The dimensions displayed are just for visualization purposes, but feel free to utilize them. I am interested in moving the smaller red <div> box and attac ...

Ways to revamp the overall aesthetic of the entire project

Is there a way to change the colors of all elements in a project when a user checks a checkbox, without having to add a class to each element? Perhaps using a service or a different method? ...

Having trouble with your jQuery animation on a div?

Check out this jsFiddle example: http://jsfiddle.net/uM68j/ After clicking on one of the links in the demo, the bar is supposed to smoothly slide to the top. However, instead of animating, it immediately jumps to the top. How can I modify the code to ac ...

Displaying HTML content in UITableViewCell on iOS

Can anyone assist me with rendering HTML content containing images and text in different cells of a UITableView? My data source consists of HTML content that needs to be displayed on UITableViewCells. I have attempted using Attributed strings on UILabel a ...

"Troubleshooting cross-domain issues with iframes in Internet Explorer

My application is built with angularjs and we offer the option to embed it on other websites. Everything works well in IE11, but when the application is iframed onto a different domain's website, it stops working. I've tried adding <meta htt ...

Troubleshooting: Bootstrap 5 Submenu Dropdown Fails to Expand

I am struggling with implementing a dropdown menu in Bootstrap 5. Although the dropdown menu is visible, I am facing an issue where the submenu items do not expand upon clicking. Below is the code snippet that I am using: <body> <nav class=&qu ...

What is the best method to design a navigation bar that is responsive to different screen

I'm facing a challenge with making my website responsive. I've successfully made all the pages responsive, but I'm struggling to finalize the navigation part. You can view my website at www.christierichards.co.uk/gcc_website/index.php When ...

Angular 7 - Issue with Loading Material Component Styles

In the midst of my latest Angular 7 project, I decided to incorporate the out-of-the-box material components. Unfortunately, there seems to be a hiccup with some of the CSS not being applied and pinpointing the cause is proving to be an elusive task. For ...

MUI provides the flexibility to adjust the opacity separately for Chip labels/icons and backgrounds

My objective is to customize the opacity of label/icon and background in MUI Chip. I want the label & icon to have an opacity of 1, while the background should have an opacity of 0.0571. Technologies used in this project include React, TypeScript, Materia ...