Hovering causes adjacent elements to shift to the right

Whenever I hover over one of the long <li> elements, the other elements shift to the right.

To view the fiddle code, click on the link below:

.footer_links{
          margin-top:60px;
        
        }

        footer .ourServices{

        display: inline-block;
        float:left;
        margin: 0px -10px 0px 77px;
        
        }

        footer .ourServices ul li,a,h3{
          text-decoration: none;
          color:white;
          list-style: none;
        }

        footer .ourServices .columns_title{
          text-transform: uppercase
        }


        footer .ourServices .columns_title{
          margin-bottom:17px;
          font-size:23px;
          font-family:raleway-regular;
          font-weight:lighter;
        }
        footer .ourServices ul li, h3{
          margin-bottom:8px;
          font-size:12px;
        }

        footer .ourServices ul li{
          margin-top: 10px;
        }

        footer ul li:hover{
          font-family: 'Open Sans';
          font-weight:bold;

        }
<div class="footer_links">
                                        <div class="ourServices">
                                            <h3 class="columns_title">Connect</h3>
                                            <ul>
                                                <li>1234 Street Name</li>
                                                <li>Suburb Title</li>
                                                <li>State, Australia 400</li>
                                                <li>Phone:(00) 000 000 000</li>
                                                <li>fax:(00) 000 000 000</li>
                                                <li><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b42454d446b4e464a705484446">[email protected]</a></li>
                                            </ul>
                                        </div>
                                
                                        <div class="ourServices">
                                            <h3 class="columns_title">Our Services</h3>
                                            <ul>
                                                <li><a href="#">Comprehensive geriatric assessment</a></li>
                                                <li><a href="#">Falls, mobility problems</a></li>
                                                <li><a href="#">Incontinence</a></li>
                                                <li><a href="#">Polypharmacy</a></li>
                                                <li><a href="#">Osteoporosis</a></li>
                                                <li><a href="#">Frailty</a></li>
                                            </ul>
                                        </div>
                                
                                <div class="ourServices">
                                            <h3 class="columns_title">Explore</h3>
                                                <ul>
                                                    <li><a href="#">Our Doctors</a></li>
                                                    <li><a href="#">Treatments</a></li>
                                                    <li><a href="#">Appointments</a></li>
                                                    <li><a href="#">Services</a></li>
                                                    <li><a href="#">About</a></li>
                                                    <li><a href="#">Contact</a></li>
                                                </ul>
                                        </div>

View jsFiddle here: jsfiddle.net/#&togetherjs=kdkeI5Hnq6

Answer №1

The reason for this issue is that the width of each div is dependent on the width of its content, and the positioning of other divs relies on the positioning of adjacent div. The hover effect causing the text to become bolder leads to an increase in width, triggering a domino effect on the layout of other elements.

A workaround would be to set a fixed width for the container so it doesn't resize based on its content:

footer .ourServices {
    width: 170px;
}

Answer №2

To specify the width for your specific class, use the following code:

 section .featuredContent
 {
   width: 200px;
 }

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

How can you ensure an image is centered properly when padding is applied?

Is there a way to center an image without affecting padding around it? Check out this sandbox for reference HTML <div class="imageParent"> <figure id='img-div'> <img class='image card' ...

Steps for adding buttons in a popover

I've been attempting to embed HTML attribute buttons into a popover in Bootstrap 5 using JavaScript. My goal is to create a clear button with the following function: However, the button is not displaying, only the text within the popover. https://i ...

Ways to avoid Bootstrap popovers from automatically breaking lines

I am struggling with adding a tooltip using Bootstrap's popover. Here is what I have tried: <ul> <li>Entry 1 ....................................................................</li> <li>Entry 2 ...................... ...

How to display umlauts (åäö) using Verdana font in Internet Explorer versions 8 and 9

Encountering a strange issue on certain pages where the rendering of umlauts (åäö) appears incorrect in IE8 and IE9 at times. The encoding is utf-8 (and most of the site functions correctly, so I know it's correct). I have attempted to isolate the ...

Remove the active class after it has been clicked for the second time

Currently, I am working on a menu/submenu system where I want to toggle active classes when clicked. However, I encountered an issue - if the same menu item is clicked twice, I need to remove the active class. Initially, I tried using jQuery's toggleC ...

Differences in Spacing: Exploring Bootstrap v5.1.1 Compared to 4.0

After comparing two pages, one using Bootstrap v5.1.1 and the other with 4.0.0, I have observed differences in spacing. Bootstrap v5.1.1: .topspacer { padding-top: 70px; } .righticon { float: right; } .clear { clear: both; } a { text- ...

Is there a way to trigger an image flash by hovering over a button using the mouseover feature in AngularJS2?

When I hover over the 'click me' button, I want an image to appear on the webpage. When I stop hovering, the image should disappear using the mouseover option. This is what I attempted in my app.component.ts and my.component.ts files: Here is t ...

The process of making an image fill an entire div using Html and CSS

What is the best way to make an image fill an entire div using Html and CSS? ...

Should scripts be replayed and styles be refreshed after every route change in single page applications (SPA's)? (Vue / React / Angular)

In the process of creating a scripts and styles manager for a WordPress-based single page application, I initially believed that simply loading missing scripts on each route change would suffice. However, I now understand that certain scripts need to be ex ...

Issues arise with the functionality of custom jQuery sliders

I'm attempting to create a bootstrap panel slider using my own jQuery code, but it's not functioning as anticipated. My Objective: I have two links for "previous" and "next", and three panels with distinct headings. When the "previous" link is ...

Executing a function defined in a .ts file within HTML through a <script> tag

I am attempting to invoke a doThis() function from my HTML after it has been dynamically generated using a <script>. Since the script is loaded from an external URL, I need to include it using a variable in my .ts file. The script executes successfu ...

Is it achievable to create shadows that do not overlap?

When you hover your mouse over the pill-shaped object, it should smoothly move over the circle as desired. However, the shadow of the circle still remains visible creating an unwanted effect. I am looking for a solution where the shadows do not overlap but ...

Tips for displaying lower quality images while initially downloading higher quality versions

I need to download and display a large image in an img tag. Since the image is not Progressive JPEG, it will render as it downloads. Is there a way to show a low-resolution version of the image while it fetches from the server using only CSS or an HTML p ...

The HTML webpage is optimized for desktop and tablet viewing, but has difficulty displaying correctly on mobile phones

Just starting out with HTML and created a website using HTML and CSS that is now live. It looks good on desktop and tablet (iPad) but not so great on mobile devices. Tried different solutions, including viewport settings, to fix the issue with no success. ...

The Bootstrap Carousel cannot be manually manipulated to switch images

I've run into an issue while trying to integrate a Bootstrap carousel gallery on my webpage. Although the photos automatically change after a few seconds, I am unable to manually switch them using the control buttons. Even after including Jquery, Po ...

Having difficulty adding a Dropdown Menu in a Pop-up Box

I am trying to incorporate a select menu inside of a popover, but every time I attempt to do so, the popover content block remains blank. The popover is associated with a side menu item called "Date History". Below is the code snippet I am using to constr ...

dragging and dropping files for easy upload

Here is a challenge I am facing: I am looking for a solution that allows users to drag multiple images from their local file system onto the flash/flex/html5 app. The app should then extract the file name details and communicate with the server. Once t ...

Expanding your selection capabilities using BeautifulSoup

My objective is to harness the power of BeautifulSoup in a unique way. Within my HTML files, there are two specific tags that catch my interest. The first one, which I'll refer to as TagA, is <div class ="A">...</div> The second tag, k ...

Troubleshooting the issue with the <div> tag in ASP.NET MVC 2 and the "float: left;" property. Any solutions to

Issue with the usage of <div> elements Everything runs smoothly: Text "Whatever" appears in column 1, followed by a radio button: No issues here (text without a radio button): The cell immediately following the text "Whatever" should display in co ...

Bootstrap triggering unexpected behavior in navbar styles

As I delve into the world of HTML, CSS, and JS, I encountered a peculiar error while using Bootstrap that seems to be affecting the links in my navigation bar. Here's the CSS I've been using: https://pastebin.com/naVZuzaG And here's the co ...