Why has my image suddenly increased in size?

As a mid-level backend developer, I pride myself on being able to solve problems independently. However, there is something about the act of writing out my issue that always seems to lead me towards a solution. It's like the concept of "rubber-ducking" that has been talked about before.

Recently, I encountered an issue where my Bootstrap (always struggle with spelling that word), bootStrap, branded image was appearing huge and covering the entire screen.

Despite inspecting it in Chrome and searching for width and size-related styles, I couldn't find the culprit. I began unchecking various rules to see if anything changed, but the size remained the same!

<%= link_to( (image_tag "Hockey_Protege_A_white.png", alt: "brand"), root_path, class: "navbar-brand" ) %>

Update 1

After comparing the broken branch to a working one, I identified the CSS that was responsible. When I unchecked it, the image reverted back to its proper size.

.app-navbar .navbar-brand img {
    width: 85px;
}

Answer №1

Oops, I just realized that I forgot to transfer the Application level styles into the application.scss :(

After incorporating this (which was suggested by a user but they deleted their answer because I mentioned wanting it to work "out of the box" and mistakenly assumed I didn't need any additional styling :( ), it finally worked:

.app-navbar .navbar-brand img {
  width: 85px;
}

I'm still puzzled though because bootstrap (

gem 'bootstrap', '~> 4.0.0.beta'
) stylesheets were loading and they contain a .navbar-brand class so if the styles weren't being found in the application.scss, why couldn't it locate them in @import "bootstrap";?

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

Failure to Connect HTML with Stylesheet

Feeling a bit lost here. I've been attempting to connect my homepage to my stylesheet, but no matter how often I refresh the page, it just won't recognize the link. I'm diligently following the instructions from the guide I have, copying and ...

Quiz application features various button states for optimal user interaction

I am in the process of creating a quiz that resembles the popular BuzzFeed quizzes such as THIS ONE. Although I have mapped out the logic and have an idea of how to code it to function similarly to the one provided in the link, I am encountering issues wit ...

The CSS slide effect is causing an overlap with the sticky top menu bar

When scrolling, the goal is to have the menubar stick as the second div with the other divs going under it. However, only the third div, the sliding banner, is overlapping with the sticky menubar while the others are functioning correctly. Is there anyone ...

The font face feature does not seem to be functioning properly in the IE browser

I'm facing an issue with font face in a jQuery popup. It seems to be working fine on Chrome and Firefox, but it's not rendering properly on IE browsers. Font Face Code in css ---------------------- @font-face { font-family: "pt-sans"; sr ...

The opacity attribute in CSS is not producing the desired outcome

After numerous attempts, I have yet to successfully create the desired effect on the screen I am currently working on: https://i.sstatic.net/BonQa.png My goal is to achieve a transparent effect using a gradient as a background, but so far my efforts have ...

Is it possible for IE7/8 to show position:relative elements in front of position:absolute ones?

The layout I have created utilizes absolute positioning and includes a CSS-based menu in the header section. It functions perfectly in Firefox, however, when viewed in Internet Explorer 7 and 8, the menu dropdowns are hidden by the content area. Unfortunat ...

Dynamic content container with customizable sidebar

I have a query that remains unanswered in my research on various CSS layout options. Hence, I decided to share it here. My ongoing project involves a fluid/fixed two-column design. The main content is placed on the left side while the sidebar resides on t ...

The presence of a Bootstrap addon is resulting in horizontal scrolling on mobile devices within the webpage

I am encountering a peculiar issue with an input-group in my cshtml file which features a Bootstrap addon. The problem arises on mobile devices, where upon focusing on the input field, the page scrolls horizontally to the right, revealing the right margin ...

Enable CDATA support in ActionView::Base.full_sanitizer

One method I found helpful was using the ActionView::Base.full_sanitizer.sanitize(value) to remove HTML content. It generally works well, but there is an issue when the value passed into the method is wrapped in <![CDATA[ and ]]> because it returns a ...

Controlling multiple bx-sliders with a single pager using only JavaScript

Is there a way to control 3 sliders using the same pager? I attempted to use the following code but it did not work: <script language="javascript"> $('.mobile_left_mble,.mobile_right_mble,.text_btn').bxSlider({ //pagerCustom: '#bx- ...

How can I incorporate a dropdown menu into my website's navigation using Bootstrap 4 alpha?

This content is based on the Bootstrap v4 Alpha blog theme. I integrated it into a project but encountered issues when trying to add a dropdown menu to the navigation bar. Despite my attempts, the dropdowns did not appear as expected. I included the code ...

tips for maintaining text size without affecting the layout of surrounding elements

https://i.sstatic.net/xQLFr.png I need to align the content of two divs in the same location, but the length of text in the first div is affecting the positioning of the body content. This is causing the two divs to look different. I want the body content ...

TSDX incorporates Rollup under the hood to bundle CSS Modules, even though they are not referenced

I have recently developed a React library with TSDX and you can find it here: https://github.com/deadcoder0904/react-typical This library utilizes CSS Modules and applies styles to the React components. Although the bundle successfully generates a CSS fi ...

An iframe for the Vimeo player set to 100% of

I encountered some challenges while styling the Vimeo video I embedded. Here is the player I am using: I want the player to occupy the entire screen for all viewport sizes, so I applied min-width: 100vh and min-height: 100vw. I was able to adjust the wi ...

Chrome compatibility issue with margin collapsing

I'm currently working on a website and encountering a CSS issue. It appears fine in Firefox, but has some odd layout problems in Chrome. I would appreciate any assistance on how to resolve this issue. On the main page, if you scroll down, you'll ...

Displaying a collapsible table directly centered within the table header

I am having trouble centering my table header in the web browser page. When I click the "+" button, the data is displayed beneath the table header, but I want the collapsible table to be centered directly below the header. I have tried making changes in CS ...

Challenge encountered when trying to add overlay hover effect on image cards

Yesterday I faced a challenge with a tracking problem while trying to implement code on a w3schools webpage. The issue was with a hover effect triggering an overlay when the mouse was placed anywhere on the line, rather than just within the card area. I&ap ...

Position child divs at the center of the parent div

I am struggling to center 3 child divs inside a parent div that must remain at a width of 100%. Can someone help me figure out how to achieve this? .parent { width: 100%; border: 1px solid blue; } .child { float: left; borde ...

Mobile devices are experiencing an issue with extra white space appearing on the right side of websites

Having trouble with my website's mobile view... The issue is that on every mobile device, the site looks exactly like it does on desktop (which is good), but I can't seem to debug and find the CSS error causing a white space on the right side of ...

Having difficulty moving the menu buttons to the right

Take a look at the code snippet below: https://jsfiddle.net/fcx0wkq3/1/ When you expand the result window, you'll notice the menu buttons on the left. I am trying to adjust the position of these menu buttons to bring them towards the center or the r ...