Limit the width and define the color using CSS for a designated popover container (referred to as help icon1)

Is there a way to specifically target a container with CSS selectors?

I attempted to apply CSS changes to help icon1 only, and not help icon2.

The specific CSS changes I want to make to the help icon1 popover are: Set the title (h6) to red color and limit the maximum width of the Popover Container to 385px

Visit this link for an example.

$('.ico').popover({
    placement: 'bottom',
    container: 'body',
    html: true,
    content: function () {
        return $(this).next('.popper-content').html();
    }
});

$('.icon2').popover({
    placement: 'bottom',
    container: 'body',
    html: true,
    content: function () {
        return $(this).next('.popper-content').html();
    }
});
body {
    padding: 50px;
}
.popover-title {
    color: blue;
    font-size: 15px;
}
.popover-content{
  max-width:385px;
}
  div.test div.hide h6{
    color: red;
    font-size: 10px;
} 
 <div class="test"> 
               <i class="fa fa-question-circle ico" 
               data-toggle="popover"  data-placement="right" 
               data-trigger="hover" >help icon1</i>
               
<div class="popper-content hide"><h6>
Title in Red. </h6>
  <ul>
    <li>Apply max-width of 385px to the Popover Container.</li>
    <li>Example 1.</li>
  </ul>
</div></div>      

<div class="test"> 
               <i class="fa fa-question-circle icon2" 
               data-toggle="popover"  data-placement="right" 
               data-trigger="hover" >help icon2</i>
               
<div class="popper-content hide"><h6>
Title in Black </h6>
  <ul>
    <li>No specific width applied to the Popover Container.</li>
    <li>Example 2.</li> </ul>
</div></div>      
      

Answer №1

It seems like the task you are attempting cannot be accomplished using the current method of loading the content. The bootstrap popover feature places the popper-content in a specific section of the DOM that is inaccessible for targeting.

Have you considered simply applying a class with color:red directly to the h6 element you desire?

Feel free to check out this demo on JSFiddle: http://jsfiddle.net/E5Ly5/684/

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

Unsuccessful attempt at a basic CSS transition - no success

I'm currently trying to create an image with a gradient that disappears on hover, but I'm struggling to get the transition effect to work. I've experimented with various webkit transitions without success. Here's the HTML: <a href= ...

Will the rel attribute work in all web browsers and with all HTML tags?

Confirming that it is compatible for use with JQuery scripting. ...

issue with centering using margin auto

Below is the HTML and CSS snippet for reference: * { margin: 0; padding: 0; } html, body { height: 100%; width: 100%; } header { height: 100px; background-color: #35424a; ...

"Ensure div remains at the bottom of the page even while

In order to implement a feature where the menu sticks to the top when scrolling down, you can use the following JS code. You can view a live example of this functionality on this Plunker by widening the preview window to see the columns side by side. wi ...

Leveraging the amplify/reduce function with radio button selection

Please select from the following options: Using the up/down buttons in the main input should adjust the value accordingly. Clicking on any of the radio buttons below will update the price with the selected value. .priceBlock { width: 80%; border-r ...

Are you familiar with PowerShell and its innovative modular GUI capabilities?

One challenge I face is assisting clients who constantly monitor the performance of their servers, services, and network. Utilizing PowerShell, I envisioned creating a unified GUI interface for all these tasks, including remote log tailing capabilities. B ...

Unable to add a logo to the header in react-material kit

I am in the process of trying to incorporate my logo into the top header section of the page, but I am facing some challenges with the code provided. import React from "react"; import classNames from "classnames"; import PropTypes from "prop-types" ...

Struggling to figure out why BXSlider won't cooperate

I'm struggling to make BXSlider work on my website. Here is the code I have used. The JS/CSS files are properly linked and downloaded from the site with correct paths. $(document).ready(function(){ $(document).ready(function(){ $('.bx ...

Steps to Create Javascript Image Zoom Effect on Mouse Hover

Looking to implement a feature on my website located at www.thetotempole.ca/javas2.html/. Basically, I have a table with images and I want them to enlarge when a user hovers over them and return to normal when the cursor is moved away. Is there a way to ac ...

type your response here

I am working on an input field for credit card numbers and I want to customize the behavior of the default placeholder. Instead of a regular placeholder, I want to implement a specific pattern: "xxxx-xxxx-xxxx-xxxx". The goal is for users to only be able t ...

Discovering the Javascript Code Executing on a <span> element with the Help of Chrome Inspector or Firebug

I have encountered a situation where a website is dynamically generating information into <span></span> tags using jQuery. The span has a class of "Price" and an id corresponding to a Product Code, with the data being pulled from a JSON data sh ...

CSS: Overlapping pop-up obscuring another element

I am having an issue with my pop-up appearing behind another control, specifically an auto-complete text box. <div id="navTarget"> <ul class="menuTarget"> <li><a href="#"&g ...

Angular 4 incorporating a customized Bootstrap 4 accordion menu for seamless navigation

I am trying to implement a nested menu using a JSON object in Angular 4. Below is the code I have written. <div id="panel-group"> <div class="panel panel-default" *ngFor="let mainItem of objectKeys(my_menu); let i = index"> <div class ...

Footer rises with bootstrap zooming

Hey everyone! I'm a beginner in the world of web development and currently working on creating my own website. I've run into an issue with my footer - I want it to stay fixed at the bottom even when zoomed in, but for some reason, when I zoom in, ...

Retrieving the value of a select option from an HTML form using the $_POST method

I have a select element in my HTML code with options listed inside: <select name="taskOption"> <option>First</option> <option>Second</option> <option>Third</option> </select> Can someone provide ...

Error encountered at the conclusion of input within a search button segment

I am currently in the process of developing a webpage that accepts a string input and then utilizes the Wikimedia API to search Wikipedia for 10 relevant pages. The issue I am facing lies within my JavaScript success function, where I intend to populate a ...

The hyperlink appears to be malfunctioning

I've been working with a jQuery multilayer menu, but I encountered an issue with the link not being clickable. For reference: jQuery: JS Array Demo: When navigating through the menu on the demo site - "devices" -> "Mobile phones" -> "super s ...

Tips for preventing Bootstrap 4 from automatically adjusting the height of all columns equally

I am receiving text from a loop that I am formatting into lists inside columns. I am attempting to float all my columns one behind the other without any space, but Bootstrap is applying the same height to all of them. Here is an example of what it currentl ...

Steps for transforming numerous HTML tables into a pandas dataframe with the help of a personalized method

I've been facing a challenge in converting multiple HTML tables into a pandas dataframe. I created a function to achieve this, but it's returning an empty list [] instead of the desired pandas dataframe. Here is my current approach: Gathering al ...

utilizing a wildcard to aggregate various components

I am working with HTML and have multiple input elements. I want to create an XPath query using a wildcard character to replace the numeric value in a specific attribute in order to select all input elements. I tested //div/input[contains(@name, "name")] an ...