CSS styles not displaying correctly - malfunctioning (unusual)

Trying to tackle this issue, but feeling a bit lost. Whenever I resize the site below 1600px, everything breaks despite having media queries in place to handle the changes. One particular problem that's baffling me is related to a logo in an id that should be 175px in height and auto width. However, it consistently appears as 564px no matter the browser size. Take a look at the code below:

img #fpa-logo {
  bottom: -25px;
  height: 175px;
  margin-left: 12.5%;
  position: absolute;
  width: auto;
}
<div class="row">
  <div class="col-sm-12 nav" id="nav-w-back">
    <div class="col-sm-5 fLeft">
      <a href="http://www.fpacny.com"><img src="../images/FPA-logo-new150-02.png" alt="FPA Logo" id="fpa-logo"></a>
    </div>
    <div class="col-sm-7">
      <ul class="nav fRight" id="nav-ul">
        <li><a href="#">Home</a></li>
        <li><a href="#">Services<span style="font-size: .75em"> &#9660;</span></a>
          <ul>
            <li><a href="#">Personalized Care</a></li>
            <li><a href="#">Health Care Services</a></li>
          </ul>
        </li>
        <li><a href="#">Links<span style="font-size: .75em"> &#9660;</span></a>
          <ul>
            <li><a href="#">Patient Information and Forms</a></li>
            <li><a href="#">Patient Friendly Sites</a></li>
          </ul>
        </li>
        <li><a href="#">Staff Bios</a></li>
        <li><a href="#">Careers</a></li>
        <li><a href="#">Contact</a></li>
      </ul>

    </div>
  </div>
</div>

If you want to dig deeper into the code, you can check out the test site: where you can experiment with different sizes and see the issue for yourself. It seems like adding an inline HTML style of:

style="height: auto; width: 100%;"

is the only way to properly resize the main image background. Otherwise, it also breaks.

Why isn't my linked CSS taking precedence here? This problem is new to me, and it's incredibly frustrating!

JSFiddle: https://jsfiddle.net/hjo8pLxe/

Answer №1

Make sure to include the following code to target the logo:

img#fpa-logo

If you're using Bootstrap 4, consider using the "img-fluid" class on the image. This class will prevent the image from getting too large and will automatically scale it down if needed.

<img class="img-fluid" {...} >

Do you require any additional functionality other than automatic resizing?

Additionally, explore the column features in Bootstrap as an alternative to using position: absolute in your CSS. This will simplify your design and reduce the chances of errors.

Answer №2

Revamp your stylesheets with the following changes:

img#fpa-logo {
  bottom: -25px;
  height: 175px;
  margin-left: 12.5%;
  position: absolute;
  width: auto;
}

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

Utilizing ellipses within a list item to create a visually appealing design

I've been struggling with this problem for hours, but I can't seem to find a solution. How can I ensure that the text in a list item respects the size of its parent container and uses an ellipsis when necessary? Here's the scenario: <?P ...

One of the unique CSS properties found in the NextJS setup is the default 'zoom' property set to

Even though I already found a solution to the problem, I can't help but wonder what the author meant by it. Hopefully, my solution can help others who may encounter the same issue. After installing the latest NextJS version 13.2.4 on my computer, I e ...

Dynamic tables that reorganize when viewed on different devices

While working on a responsive website with Magento v1.8, I encountered a challenge in making the header responsive. I attempted using div but couldn't get it to work as expected. Switching to the table method has brought me halfway there, but I'm ...

Bootstrap version 4.1 featuring two columns that overlap each other

Can anyone help me implement this design in bootstrap 4? Currently, I am using the following code snippet: .outer1:after { box-sizing: border-box; content: ''; position: absolute; top: 50%; margin-top: 0; top: 0; right: -10px; background-color: ...

What causes performance issues when utilizing mouseover events in JQuery?

var mouseX; var mouseY; $(document).mousemove( function(e) { mouseX = e.pageX; mouseY = e.pageY; }); $(".test").mouseover(function(){ $('#DivToShow').css({'top':mouseY,'left':mouseX, 'display':'block&ap ...

The functionality of Google Maps code is limited on Android devices because the map feature is not available

After updating the Google Maps embed code to be responsive for mobile devices, I discovered that the map still won't display on Android or iPhone. The following is the modified code. Can anyone assist me in resolving this issue so that the map can sho ...

The navigation bar designed with flex boxes is experiencing an issue where the "Login" button positioned on the right is being partially hidden

My website's navbar has a display: flex property to provide padding around the links, but it is causing some issues with overflow. For more details, you can check the JSfiddle link here: https://jsfiddle.net/Bradley_/3bhroby2/3/ I have noticed that m ...

Fetch information post search action through Ajax on a single PHP page

Looking for some guidance on using AJAX and PHP together. I've set up a page that uses AJAX to load data, and it's displayed with pagination. However, I'm struggling to redirect the search results back to birds.php. birds.php <script ty ...

The issue of assigning Ajax data to jQuery inputs with identical classes is not being resolved correctly

I am currently developing an Invoicing System where the Rate(Amount) value changes automatically when the Product(Item) is changed. The issue I am encountering is that when I change the first Product, all the other Product Rates change to the Rate of the ...

Is there a way to reset my div back to its initial background color when clicked a second time?

I am currently utilizing the jQuery addClass and removeClass animate feature for my project. Basically, what is happening is that when the user clicks on a particular link, a dropdown navigation will appear. This feature is essential for ensuring responsi ...

JQuery is having trouble with playing multiple sound files or causing delays with events

I've been working on a project that involves playing sounds for each letter in a list of text. However, I'm encountering an issue where only the last sound file is played instead of looping through every element. I've attempted to delay the ...

Smoothly transition between the new and existing child elements in a React component with a

Currently, I am utilizing a React component that renders a child element through props.children. The content within this child element varies dynamically. I am looking for the most effective method to smoothly transition (fade out the old element and fad ...

Incorporate descriptive text to my HTML slider

How do I customize my carousel to display unique titles or captions for each slide? Here is the code snippet provided: <h1>Incredibly Basic Slider</h1> <div id="slider"> <a href="#" class="control_next">>></a> < ...

Tips on positioning two images in separate locations within a table cell?

I have a cell containing two images. I want one to be centered in the middle of the cell and the other in the top right corner, overlaying the centered image. My goal is to achieve this layout https://jsfiddle.net/5bL56a34/ without specifying the left m ...

I want to perfectly center the text horizontally within a table while still aligning it to the left [Using HTML and CSS]

I have a few tables displayed on my website and I am seeking ways to enhance their appearance. Here is how my table currently appears (http://prntscr.com/gpa4w6) I am aiming for this desired look (http://prntscr.com/gpa52q) In the image above, you can n ...

choose the <li> element with no <a> tag

Hello there, I am looking for a way to keep the padding consistent in <li> elements, but have it applied to the <a> tag instead when it's a link (to create a larger selection area). li a { padding: 1rem; } li:not(a) { padding: 1rem ...

Optimal method for passing a variable to external PHP code

I have encountered difficulties in getting my code to work, and I am seeking guidance on the correct approach to take. The issue lies within a page that contains a dynamically generated select box populated with names from a MySQL database. The select box ...

Tips for checking form input validity prior to opening a modelDialog

After successfully validating all required form fields, I am trying to open a modal dialog. Although I have managed to validate the form, I am struggling to write the code that will trigger the opening of the modal dialog upon successful validation. Do y ...

AngularJs and graph representation

After attempting to generate charts using angular-chart, I followed all the necessary steps and requirements outlined in the documentation. However, upon completion, my canvas element failed to display any content. My HTML Layout: Here is a snippet of my ...

How can we create a stylish HTML table using CSS display:table and SASS in a sophisticated manner?

Is there a more stylish approach to styling this HTML table using CSS display: table with Sass? Instead of using traditional table elements, I have created a table layout using display: table CSS styles applied to div elements: <div style="display: ...