Having Trouble with Nested Sass?

I can't seem to wrap my head around why this nested sass isn't functioning as expected. Here's the snippet of my HTML code:

%h1 Office Listing
#office-holder
  .listing-stats··
    #address·
      =@office_listing.address
    .listing-stats-2
      #rent
        %span.special2 Rent:·
        $#{@office_listing.rent}/month
      #size
        %span.special2 Space:·
        #{@office_listing.size} sq. feet

All of this is contained within a div that gives a namespace to the HTML page, with two unique ids -- #office_listing and #show. Since I'm working with Rails, I'm utilizing namespaces to organize views for my CSS stylesheet. Take a look at the troublesome CSS below:

#office_listing#show {
  #address {
    width: 100%;
    font-size: 50px;
    background-color: #A0183C;
    height: 100px;
    text-align: center;
    margin: auto;
    font-size: 30px;
    padding-top: 35px;
    color: white;
  }
}

Despite everything seemingly compiling correctly, the CSS styles aren't reflecting on the page. Upon inspecting the compiled stylesheets, they appear like so:

#office_listings#show #address {
  width: 100%;
  font-size: 50px;
  background-color: #A0183C;
  height: 100px;
  text-align: center;
  margin: auto;
  font-size: 30px;
  padding-top: 35px;
  color: white; }

This should ideally target the specific HTML element, but it's just not working. What could be causing this issue?

Answer №1

Is it possible to use double ids? In the case of #office_listings#show, it suggests having two ids on one element which goes against standard practice. It is more effective to make "show" a class and modify it like this: #office_listings.show #address

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 CSS positioning be utilized to align lines accurately?

Recently, I created a basic jsbin to draw a line connecting two points. It doesn't rely on any drawing libraries; just plain JavaScript and jQuery. I managed to calculate the angle using code I found in this library. When dragging the circle at the ...

What is the best way to add bind-attr class to an existing class in Ember framework?

Is there a way to add a dynamic CSS class onto an initial static one using the {{bind-attr}} method? The problem I am facing is that when there is a static initial class, the dynamic class does not get added when the page loads. However, once I change the ...

Having trouble showcasing two unordered lists side by side on a single line

In my Magento Go store, I am showcasing products using CSS only. Currently, the loop is set to display 5 products in a row and then close the <ul> tag. However, if there are more products, a new <ul> element is created. My fixed width only allo ...

Use CSS to create a fullscreen animation for an element

Is there a way to animate a div element so that it expands to fit the screen when clicked without specifying an initial position? I need the div to be able to adjust dynamically within the screen. .box { width: 80px; height: 80px; background: red; ...

Mobile responsiveness issues with Bootstrap 4 row

<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS ...

Using unicode characters to style your Angular application

Hey there! I have an Angular 5 app on StackBlitz that implements table sorting. You can check it out here: https://stackblitz.com/edit/angular-rxdzom. The code for this app is based on the example from . In the app, I've used a stylesheet at ./app/sor ...

Using an icon font as a background in CSS attribute

I am struggling to replace a background image in CSS with an icon font instead of an icon image. I have been unable to accomplish this task. Here is the CSS property I am working with: .social-networks .twitter{background:url(../images/social/twitter.png) ...

Unable to manipulate or customize the V-slot component

I recently implemented the v-flip feature on my Nuxt webpage, resulting in the following template: <div class="about__cards"> <vue-flip class="about__single-card" active-click width = "350px" height="450px"> <template v-slot:front> ...

Exploring dynamic page linking with ui.router in Angular

In the process of developing a backend rails application that generates an API for consumption by a front end ionic app, I encountered an issue. Despite having experience with Angular, my familiarity with Ionic is limited. The specific problem lies in link ...

Pressing a button to alter the text color

While experimenting, I attempted to alter the text color of my HTML using JavaScript. After a few attempts, I came to the realization that I cannot change the color if I am already changing it in CSS. Does this mean CSS is executed at the end? Also, how ca ...

Customizing the appearance of the dragged element in jQuery UI

Is there a way to modify the color of a draggable list item after it has been dragged? Any assistance is greatly appreciated. $("#DragWordList li").draggable({helper: 'clone'}); ...

Creating a CSS class in a separate file for an element in Angular 4

Looking for some help with my code setup. Here's what I have: <div class="over"> Content </div> In my component file, this is what it looks like: @Component({ selector: 'app', templateUrl: './app.componen ...

Modify the css with JQUERY when there are no rows inside the tbody section

Is it possible to change the css using jquery if there are no rows in the table body? I have attempted this but my current approach is not working. I tried adding an alert within the if statement, but the alert did not appear. My goal is to hide the table ...

The functionality of Bootstrap 5 sass components seems to be malfunctioning

Despite having Bootstrap 5 installed, my design is working perfectly fine but the Bootstrap components like accordions and alerts are not functioning properly. It appears that these components are missing from Bootstrap and the sass files do not have any ...

Outlook creates unnecessary spacing within tables in emails

Despite all my efforts, I am facing an issue with Outlook adding an unwanted gap after one of my tables in my responsive email design. I have tried various solutions such as adding border-collapse:collapse, dividing tables, and using block styling for imag ...

"Create a link in Rails to navigate to the next item in the array position

I'm currently working on implementing navigation links for an array in my project. The array consists of three classes: fsets, line_items, and exemplars. On a specific page of my app, users are presented with an image and I want to enable them to eas ...

Full-screen mobile menu with sliding animation

I currently have a slide-out menu on my webpage, which is 350px wide let menuGeneral = $('#menu-general'); $('#menu-up-control').click(function () { menuGeneral.animate({ right: '0' }, 500); }); $(&a ...

The Bootstrap carousel's transition effect is not functioning as expected

The fade transition I added to my Bootstrap 4 carousel isn't working properly. It seems like the effect is not being applied to the carousel. Here is the HTML code snippet: <div id="testimonialsSlides" class="carousel carousel-fade" data-ride="fa ...

Steps for generating a jQuery script to tally the checkboxes that have been ticked

[2]. In my quest to implement a checkbox functionality using jQuery, I have composed the following code snippet:- <!DOCTYPE html> <html lang="en"> <head> <title>Check Box using jQuery</title> </head> <bo ...

Ways to locate CSS file path within a web browser

Currently, I am focusing on the theme development aspect of Magento2. After compiling the .less file, I noticed that two css files are generated: styles-l.css styles-m.css Despite trying to inspect the element and view the applied CSS in the browser, i ...