Tips for styling list tooltips with CSS and Bootstrap

I am looking to style my tooltips using CSS, specifically I want the background of the tooltips to be gray and the text to be bold.

The issue is that I am unsure how to do this, especially since I have a list with multiple options, each option having its own tooltip. I want to style the tooltips within the options of my list using CSS.

Below is the code for my list:

<select id="worker" class="form-control" [(ngModel)]="selectedExportWorker" [formControl]="workerForm.controls['selectedExportWorker']" (ngModelChange)="selectWorker()">
   <option [ngValue]="blankObject"></option>
   <option *ngFor="let worker of workerExportList; index as i" [ngValue]="worker" class="tooltip" data-toggle="tooltip" data-placement="top" title="{{info_bulle_export[i]}}">{{worker.label}}</option>
</select>

Here is the current appearance of the tooltips I have: https://i.sstatic.net/AXhPp.png

And here is an example of the tooltip appearance I aim to achieve: https://i.sstatic.net/PqNv0.png

Here is the full .html code:

<div class="workers center">
    ...
    (Complete .html code is too lengthy to display here)
    ...
</div>

If you require the complete .html code, please let me know.

Additionally, here is my CSS code:

    /* CSS code for custom tooltips */
    .tooltip {
      ...
    }

    /* Additional styles for tooltips */
    * {
        ...
    }
    ... (Remaining CSS styles are also included)

If anyone can assist with this, I would greatly appreciate it. Thank you.

Answer №1

Here is a different way to approach it:

.html

<div class="custom-tooltip">
    <button type="button" class="btn btn-outline-secondary mr-2" placement="top" ngbTooltip="Tooltip on top">
  Tooltip on top
    </button>
</div>

.css

::ng-deep .custom-tooltip .tooltip-inner {
  background-color: #dddddd;
  color:#000000;
  font-weight:bold;
}
::ng-deep .custom-tooltip .arrow::before {
   border-top-color: #dddddd;
}

Check out the live demo here

Answer №2

Give this a shot as well!

[data-info] {
  border: blue solid 1px; /*additional styling*/
  padding-top: 50px; /*additional styling*/
  font-size: 20px; /*additional styling*/
  
  position: absolute;
  cursor: pointer;
}

[data-info]:hover::before {
  content: attr(data-info);
  position: fixed;
  top: -30px;
  display: inline-block;
  padding: 6px 8px;
  border-radius: 3px;
  background: #333;
  color: #fff;
  font-size: 14px;
  font-family: Arial;
  white-space: nowrap;
}
[data-info]:hover::after {
  content: '';
  position: absolute;
  top: -15px;
  left: 5px;
  display: inline-block;
  color: #fff;
  border: 6px solid transparent;    
  border-top: 6px solid #333;
}
<h2>Customizing the Tooltip</h2>
<span data-info="Additional text for tooltip">Hover over me</span>

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

There seems to be an issue with jQuery DataTables datetime-moment's date parsing functionality, as it is not

Having trouble parsing dates into MMMM YYYY format using the jQuery DataTables plugin. Check out my Plunker. I've tried using the datetime-moment.js plugin with no success. Here's the code snippet I'm working with: $(document).ready(functio ...

Exploring Objects using the for-in loop in ReactJS

This code is written in Reactjs. I am attempting to iterate through and print object data, but I keep encountering an error --> TypeError: Cannot read properties of undefined (reading 'state'). Could someone please help me identify what I am d ...

Utilizing Material-UI Select for creating a number range dynamically

Seeking a solution to create a select element using material-ui that offers a range of numbers from 0 to 20,000,000 in increments of 25,000. Currently, I have accomplished this using a for loop. for (let price = 0; price <= 20000000; price = price + 250 ...

Create a fresh Ionic 3 application utilizing Angular 4

After installing Ionic 3.6, which supports Angular 4.0.1, I encountered a problem. When creating a new project with the command ionic start newProject, it defaults to using Angular 5. This is evident from the package.json file below, showing angular-ionic ...

Error: Child component received an undefined prop

Within my parent component, I have three child components. The first child component is a form that, upon submission, passes data to the second and third child components through props via the parent component. However, in one of the child components, the ...

Establish a connection between an Angular client and a Spring backend using JWT for authentication

I successfully integrated JWT into my Spring backend by following the steps outlined in this informative guide: https://auth0.com/blog/securing-spring-boot-with-jwts/ Interestingly, when I perform a PUT request using Postman, everything seems to be workin ...

Preserve the content in the text box corresponding to the selected radio button

In my form, there are multiple radio buttons, each with an associated text box value. Users can only select one radio button at a time and submit the form. However, sometimes users will enter data in a textbox for one radio button, then switch to another o ...

Creating a dropdown menu for an extensive list of 100 menu items: a step-by-step guide

In my React JS front-end project, I have implemented a drop-down menu using Material-UI. Currently, the menu items are hardcoded which works fine for a small number of items. However, this approach becomes cumbersome when dealing with a larger number of ...

Creating uniform-sized flex items with varying image sizes

When setting flex: 1 1 0 on flex items, it does not work as expected especially when the flex items contain images of varying sizes. In this scenario, the flex-item containing the image ends up becoming significantly wider than the others. Below is the H ...

Combining PHP and HTML: Utilizing nested foreach loops with interspersed HTML code

Attempting to create a layout of items using an Accordion arrangement (from Bootstrap) has led me to retrieve data from a pgsql db. Fortunately, the data retrieval process is successful. The challenge lies in displaying this data, as I am encountering an ...

Peeling back the layers of a particular element

This is my code snippet: <pre id='code'> <ol> <li class='L1'><span>hello</span></li> <li class='L2'><span>Hi</span></li> <li class='L3&apos ...

"Retrieving the most recent data within an ng-repeat directive using AngularJS

I am facing an issue with ng-repeat in my application. It successfully fetches values from the database and displays them in input text fields. However, when I update these values and click the save button, the updated values are not being saved. Can someo ...

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 ...

Currently, I am developing a customized stylesheet specifically designed for Internet Explorer versions 10 and 11

Is it possible to utilize this straightforward script for identifying IE versions 10 and 11? if($.browser.version == 11.0 || $.browser.version == 10.0) { $("body").addClass("ie"); } ...

Error: Unable to access the 'offsetTop' property of null

I attempted to implement a scroll effect in my project. The goal was for users to be taken to a specific section when they clicked on an option in the navbar. However, I encountered an error during implementation. Below is the code snippet where the error ...

Enhancing jQuery functionality: Ensuring newly added elements are aware of existing functions

I need assistance with my HTML table. Each row (tr) contains a value, for example 200$, and a delete button. How can I ensure that each new row added automatically knows the recent functions without having to call them every time? $(function () { $(&ap ...

What is the recommended approach in Angular for unassigned @Input() variables when using TypeScript strict mode?

Issue at Hand After upgrading my Angular version from 10 to 13, I encountered a problem with the new TypeScript strict compiler mode. The upgrade required me to assign values to all declared variables upon initialization, causing issues with properties de ...

Ensuring the CSS animation reaches its ultimate state by the end

I am currently implementing an animation on specific elements that have their opacity set to 0 in the CSS. The animation is triggered onClick, and via keyframes, it transitions the opacity from 0 to 1, among other things. However, once the animation compl ...

Cease all playback of audio immediately

My goal is to ensure that any audio that has been played previously stops before a new audio clip starts playing. This will prevent overlapping clips on elements that may trigger the audio file multiple times. I have attempted to pause and reset the curre ...

Is there an equivalent of HtmlSpecialChars in JavaScript?

It seems that finding this is proving more difficult than anticipated, even though it's such a simple concept... Is there an equivalent function in JavaScript to PHP's htmlspecialchars? While it's possible to create your own implementation, ...