Show information in tooltips across several rows

Within my Vue.js component, I am attempting to craft a custom tooltip text that consists of multiple lines.

<div class="toolTip">
  Shift ('+i+')
</div>
<div class="hide">
  <div class="w-full">
   '+names[group]+'
  </div>
  <div class="w-full">
   <span class="material-icons">calendar_today</span>03 Mar 2023 - 04 Mar 2023 
  </div>
  <div class="w-full">
   <span class="material-icons">schedule</span> 
   08:00 - 18:00 
  </div> 
  <div class="w-full">
   <span class="material-icons">pending_actions</span>
   Door-to-door travel time: 6 hours
  </div>
</div>

The above code generates the following output:

https://i.stack.imgur.com/uaNIm.png

However, my intention is to have each line displayed on a separate row...

Below is the CSS I am utilizing for this feature:

.hide {
    display: none;
}
    
.toolTip:hover + .hide {
    display: flex;
    padding: 16px;
    background: rgba(9, 30, 66, 0.9);
    border-radius: 4px;
    position: relative;
    margin-top: -140px;
    text-align: left;
    line-height: 20px;
    font-weight: 400;
    font-size: 14px;
    
}

It's worth mentioning that I am integrating Tailwind CSS in my application.

Answer №1

flex-wrap: wrap;

Attempting to ensure all content fits on single line.

Suggested alternatives:

display: inherit;

or

display: inline;

Answer №2

if you are utilizing tailwindcss , you have the opportunity to take advantage of its features.

Below is an example of how you can apply classes:

    display: flex;
    padding: 16px;
    background: rgba(9, 30, 66, 0.9);
    border-radius: 4px;
    position: relative;
    margin-top: -140px;
    text-align: left;
    line-height: 20px;
    font-weight: 400;
    font-size: 14px;   
}

You can easily transform the above code to

hidden group-hover:flex p-[16px] rounded-[4px] bg-[#091E42] text-left text-white font-normal text-[14px]
.

Implementation example:

<script src="https://cdn.tailwindcss.com"></script>
<div class="group p-4 space-y-3">
<div class="p-[10px] rounded-[4px] bg-[#091E77] text-left text-white font-normal w-56 cursor-pointer ">
  Shift ('+i+')
</div>
<div class="hidden group-hover:flex p-[16px] rounded-[4px] bg-[#091E42] text-left text-white font-normal text-[14px]">
  <div class="w-full">
   '+names[group]+'
  </div>
  <div class="w-full">
   <span class="material-icons">calendar_today</span>03 Mar 2023 - 04 Mar 2023
  </div>
  <div class="w-full">
   <span class="material-icons">schedule</span>
   08:00 - 18:00
  </div>
  <div class="w-full">
   <span class="material-icons">pending_actions</span>
   Door-to-door travel time: 6 hours
  </div>
</div>
</div>

By hovering over the blue button, a tooltip will be displayed.

For more information on applying styles using the group utility, visit this link.

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

Turn off Appbar padding at the top and bottom

I am looking to create a customized box within the Appbar that spans the full height, as illustrated in the image below: https://i.stack.imgur.com/CFMo0.jpg However, the default Appbar provides padding from all sides to its internal elements, leading to ...

Tips for positioning a sticky div underneath a stationary header

I'm currently utilizing Bootstrap 4 for my project, and I am encountering an issue with maintaining a div that has the class "sticky-top" just below a fixed navbar. Despite attempting to use JavaScript to replace the CSS while scrolling, it hasn' ...

How to Restrict the Number of Rows Displayed in an Angular 4 Table

Currently, I am faced with a situation where I have a lengthy list of entries that I need to loop through and add a row to a table for each entry. With about 2000 entries, the rendering process is slowing down considerably. Is there a way to limit the disp ...

Unable to retrieve data in Vue using Axios for GET request

Recently delving into Vue, I'm struggling to figure out what's causing the issue in my code. Here's a simple component snippet: <template> <template v-if="loading"> Loading... </template> <te ...

Spying on functions within Vue 3 setup() is not allowed

What is the best way to create a Jest test that triggers the function resetTimer and verifies that startTimer is also triggered? JS Code: setup () { const startTimer = () => { // ... }; const resetTimer = () => { startTi ...

Creating visual elements in Vue.js using an array structure

I attempted to use Vuejs to display a list of items, and the code snippet below is a simplified version of my attempt. Despite seeing the data in VueDevTool, I am unable to render it on the page. <template> <div> <h1>{{t ...

Chronological Overview (Highcharts)

Can you customize a timeline in Highcharts to resemble the image? I have a functional example of the timeline I desire, but the color coding and filtering aspects are challenging for me. I am attempting to apply a filter that will decrease the opacity of ...

Submit the form using the GET method and update the URL

<form method=\"GET\" action=\"http://www.$domain/search/\"> <input type=\"search\" id=\"search\" name=\"search\" value=\"terms\"> </form> This form will be directed to the follo ...

PHP/CSS: Backgrounds for DIVs have been implemented, but they appear to be transparent

Update: Check out the link for some old photos here: I have a PHP file where I am creating divs with images as backgrounds using the code below (within a while-loop): echo ' <div class="pic" style="background:url('.$directory.'/'.$ ...

Create a VueJS/VuetifyJS implementation inspired by the WhatsApp swipe between tabs animation

Currently, I am utilizing the VuetifyJS framework for VueJS and I am interested in replicating the swipe between tabs transition seen in WhatsApp for Android. In WhatsApp, you have the ability to swipe left or right to view a new section as you swipe. Vue ...

Connecting two sets of data from a mongoDB database using vue.js

Hey there, I'm a newcomer to vue and mongodb. I've set up two collections - one for storing user details and the other for business details. When a business registers through a form, their information is saved in mongodb. Now, I've created a ...

Using Jquery to swap out div elements and reinitialize code after selecting a menu <a href>link<</a>

I have a jQuery script that swaps out a div when a href="#1" is clicked. The same link, a href="#1", is then replaced by a href="#2" and vice versa. Here is the jQuery code: $('.child2, a[href="#1"]').hide() $('#replacepagelinks a').c ...

Utilizing the CSS :not() selector within a nested table

I am having an issue with my AjaxControlToolkit where the main-page CSS is affecting the inner "calendar" popup. To illustrate what I need, what I've tried, and the temporary workaround, I have simplified everything into a one-page example. I am in s ...

I can't figure out why my jQuery isn't recognizing the :nth-child(2) selector

Here is the jQuery code I am using: $(".score-window a:first-child").click(function() { $(".score-window").hide(); $(".login-window").show(); }); $(".score-window a:nth-child(2)").click(function() { $(".score-window"). ...

Can the color of text be adjusted (to either white or black) based on the background color (in any color and format)?

To achieve a text color that contrasts well with any background, I need to make sure it's either black or white. The background in my app can vary in color and format, so finding the perfect solution has been challenging. Using mix-blend-mode doesn&a ...

From Table to DIV: A Simple Conversion

I have encountered a major issue that has stumped me so far. Perhaps you can assist me. I am dealing with a table that appears as follows: __________________________________ | | time1 | time2 | time3 | +--------+-------+-------+-------+ | John | ...

"Automate the process of manual content duplication with JavaScript's for each replacement

Seeking a solution to automate the selection process without writing individual JS scripts for every input. For instance, having 10 double inputs (total of 20 inputs) and utilizing the each() function or other methods by only declaring selectors. Find th ...

Generating SCSS variables dynamically in Vue.js can add a powerful level of customization and flexibility

Within my App.vue @mounted() method, I initiate an api request to acquire data for my application. Embedded in a response property called "style", the json object containing various styling information appears as follows: "style": { &qu ...

Incorporating Google's Invisible Recaptcha with Jquery Ajax and PHP

I am struggling to make my form, which includes Google invisible reCAPTCHA, work seamlessly with my jQuery AJAX and PHP. It appears that the token is not being properly sent to my PHP page via AJAX, resulting in the following error message from my PHP scri ...

Code for switching between accordion panels with a simple button press

I took some code snippets from a website and developed a shopping cart accordion module. The complete code is available on my CodePen profile, you can access it through this link: http://codepen.io/applecool/pen/YXaJLa <div class="summary"> <but ...