Steps for adjusting the position of the tooltip arrowWould you like to

My current challenge involves repositioning the Tooltip arrow on my hover box to the left side, as it currently appears at the top of the box.

This is the CSS I am using:

<style type="text/css">
* {
    font-family: Arial;
}

.input {
    position: relative;
}

.tooltip {
    display: none;
    padding: 10px;
}

.input:hover .tooltip {
    background: blue;
    border-radius: 3px;
    bottom: -5px;
    color: white;
    display: inline;
    height: 30px;
    width: 100px;
    left: 60px;
    line-height: 60px;
    position: absolute;
}

.input:hover .tooltip:before {
    display: block;
    content: "";
    position: absolute;
    top: -5px;
    width: 0; 
    height: 0; 
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid blue;
}

</style>

And here is the corresponding HTML:

<td align="left">
     <tr> 
         <br><br><br><br>
             </tr>
            <div class="input" align="left">
            <input name="amount1" type="text" align="top" class="size-box" id="amount" style="font-size: 14px; width:40px; text-align:center" onclick="this.value = '';" value="0" size="20"><span class="tooltip" style="text-align:center">Deliver Quantity</span></div>
            </td>

I'm struggling to determine which attribute in the code controls the arrow position. Any insights or help would be greatly appreciated.

Thank you!

Answer №1

To shift the arrow to the left, apply the styles below. I adjusted the arrow size to 6px for better centering since margins cannot be set to negative values.

.input:hover .tooltip:before {
    display: block;
    content:"";
    position: absolute;
    top: 50%;
    margin-top:-3px; /* Adjust based on arrow size */
    left: -6px; /* Shift arrow to the left */
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid blue; /* Color of the arrow */
}

Check out an example here

Answer №2

modify this particular class

.input:hover .tooltip:before {
    display: block;
    content: "";
    position: absolute;
    left: -5px;
    top:50%;
    margin-top:-5px;
    width: 0; 
    height: 0; 
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid blue;

}

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

What are some effective strategies for incorporating multiple Themes into an AngularJS project?

Currently, I am in the process of working on a project that involves utilizing AngularJS, UI Bootstrap, and Sass. The next step is to incorporate different themes that can be selected by the user. While I have successfully implemented the ability to apply ...

Are CSS designers setting boundaries for their designs by restricting themselves to layouts that can be handled by CSS from the start?

After seeking guidance on reaching CSS zen in this forum, I have come to realize that my struggles largely stem from positioning. Some sources suggest that CSS may not always be the most efficient layout system. As CSS designers, do we limit ourselves fro ...

Issue with the text wrapping of Angular mat-list-option items

When the text of my checkboxes is too long, it doesn't wrap properly. Please see the image below for reference: Click here to view Checkbox image and check the red box Here is my HTML code: <mat-selection-list #rolesSelection ...

What methods can be used to reveal the URL or string hidden by the current "Search" button?

I am a beginner with no coding experience. Please forgive me if my question sounds silly. I am interested in learning how to "discover" the correct string to add to an existing internal-domain-url (even though I am not the admin of that domain) in order t ...

Change the absolute positioning of a div element to be applied globally

When trying to get the position of an element using jQuery's .offset(), I then set the div to have a position:absolute; and adjust its left and top based on the information obtained from offset(). This method works well when all the element's pa ...

How can you style text with a circular border using CSS?

I'm struggling to locate an example of what I need. My goal is to make a circle around my text using CSS. While I've seen examples of circles with the text inside, in this case, I aim to have a circle surrounding the text. Here's an illustr ...

Modify just one of the padding axis while keeping the other constant by utilizing a media query

My div currently has the following padding set: padding: 14px 150px; I want to change the left/right padding without affecting the top/bottom padding using a media query. @media screen and (max-width: 700px){ #paddingDiv{ padding: same as ...

Learn how to hide a bar after clicking the "I agree" button with the help of Bootstrap

click here to see imageIs there a way to make that bar disappear once the user clicks "I agree"? I've searched through Bootstrap documentation but couldn't find a solution. Please assist. Below is the code snippet: <div id="cookie-message" cl ...

What is the best way to configure input fields as readonly, except for the one being actively filled by the user

Is there a way to make all input fields readonly except the one that the user is trying to fill data into? After the user loads the page index.php and attempts to input data into, for example, <input id="edValue2" ...>, I want to set all input field ...

The scrolling function halts as soon as the element that was middle-clicked is deleted from the

I am knee-deep in developing my own React virtualization feature and encountering a minor annoyance. When I middle click on an item in the list and start scrolling, the scrolling stops once that item is removed from the DOM. My initial thought was that the ...

When I use Input.value, it seems to cause a strange lag in my console.log

My goal is to have a text input on the page that triggers #fourChord's text to change as I type characters into the input. The issue I am facing is that console.log registers my input, but the first character is always ignored. For example, if I type ...

Contrast the positions (offsets) of two elements

I am trying to determine if one element is positioned above another by comparing their offset positions. Specifically, I need to verify whether the me element is within the bounds of the screen element using their respective offset positions. HTML Code ...

Unable to retrieve table information from HTML source code using Python and Selenium

In my endeavor to gather the odds data from this particular source, I am specifically focused on the "Over Under" segment and the over/under odds provided by Pinnacle and AsianOdds, which are accessible through the "compare" button. Here is an image descr ...

Utilizing Windows Azure Website alongside static HTML stored in Blob storage

Currently, I have a .NET MVC application deployed on an Azure Website to serve static HTML pages stored in a blob container when clicking on a corresponding link. My inquiries are as follows: When accessing a blob in Azure, the standard URL format is . ...

The same bootstrap column code shows varying behavior

This week, I delved into learning HTML with the goal of creating my own website using bootstrap. However, I encountered a perplexing error - code that should display two pieces of text on the same line is behaving inconsistently for seemingly identical sni ...

Cordova - Fixed elements flicker/blink when scrolling

I have exhausted all possible solutions, ranging from -webkit-transform: translate3d(0,0,0); to -webkit-backface-visibility:hidden but none of them seem to resolve the issue of an element flickering/blinking/disappearing when scrolling on iOS with - ...

Creating a dropdown list with the option to select without using the optgroup feature in Yii

I am currently utilizing the dropDownListRow feature of bootstrap Yii. <?php echo $form->dropDownListRow($model, 'roles', array('' => "--Select Roles--", 'Trekking Agency' => CHtml::listData(Roles::model()->fin ...

Firefox's keyup event

Is it possible to detect a keypress using the jQuery keyup function, as I am facing an issue where it works in Chrome, Edge, IE, and Opera but not in Firefox. $(".textfield").contents().keyup(function(evnt) { document.getElementById("btn_save").style. ...

List that dynamically changes in HTML email template

I'm currently working on an email template using HTML, and I've run into a roadblock while trying to create a list based on Java code data. The challenge is that the length of the list varies each time. Here's what I tried: <span st ...

Saving a picture to local storage with the file input type in ReactJS

I am attempting to save an image in the browser storage once a user selects an image from their computer. <div className="add_grp_image_div margin_bottom"> <img src={img_upload} className="add_grp_image"/> <input type="file" class ...