The CSS within a Vue Single File Component can sometimes take precedence over certain styles from buefy/bulma, while other styles may

Seeking assistance on how to troubleshoot this issue.

In a Vue project, buefy is imported from main.js as follows:

import Vue from 'vue' 
import Buefy from 'buefy'
import './style.scss'
Vue.use(Buefy)

import Client from './client.vue' 

let vm = new Vue({
    el: '#app',
    render: h => h(Client) 
})

, with style.css importing buefy/bulma styles:

@import "~bulma/sass/utilities/_all";
[...]
@import "~bulma";
@import "~buefy/src/scss/buefy";

The goal is for Buefy/Bulma css to be overridden by styles specified in single file vue components like:

<style lang="scss">
.logLine{
    margin: 0px;
    padding: 1em; 
}
</style>

An interesting finding is that while padding successfully overrides bulma styles (as expected), margin gets overridden by bulma styles:

View screenshot from Firefox CSS inspector

It appears that styles from bulma/sass/base/minireset.sass are being overridden by the .logLine style definitions within the single file component. However, the .logLine styles are being overridden by bulma/sass/elements/content.sass.

The expectation is for the styles from .logLine to override all Buefy/Bulma styles.

Answer №1

When formulating a question, it is common for details to catch your attention and lead you to the answer:

I discovered that the bulma style was overriding my styles from the single file component due to the use of the CSS pseudo-class :last-child

.content p:not(:last-child), [...] {
    margin-bottom: 1em;
}

It seems like Firefox prioritizes the :last-child selector in this case.

To resolve the issue, I added

.content .logLine:not(:last-child)
to the selectors in the single file component.

.content .logLine:not(:last-child), 
.logLine, {
    margin: 0px;
}

Now, my styles are no longer being overridden.

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

Make a diagonally slanted border for a cell

Is it feasible to create a table with diagonal borders using CSS or jQuery, similar to the one shown below? I would welcome any ideas on how this can be achieved. ...

When the @gridGutterWidth(s) is set to 0px for a flush grid in Bootstrap, the navbar's 'a.brand' breaks onto its

Big shoutout to the amazing StackOverflow community for helping me eradicate countless bugs before they even surfaced. Your crowd sourcing powers are truly magical. I'm in the process of building a website using the Wordpress Roots theme, which is ba ...

I'm having trouble displaying the result of my calculation in the code. Could it be because I forgot to include an output tag?

I am attempting to develop a Miles Per Gallon (MPG) calculator using Javascript. However, I'm encountering difficulties with displaying the results once the "Calculate" button is pressed. <html> <head> <title> MPG Calculator </ti ...

Enhancing the image by zooming in with overlapping elements on top of the background photo

I'm facing an issue with a form I created that has a background image with input elements placed over it. The problem arises when zooming in or out on the page using Chrome, as the elements tend to move away from their original position on the backgro ...

Is it possible to balance proper CSS and Javascript maintenance with the use of a Template Engine?

When using a template engine like Velocity or FreeMaker, you have the ability to break up your HTML into reusable components. For example, if you have an ad <div> that appears on multiple pages of your site, you can create a file containing that < ...

Make the background extend all the way down to the bottom of the page, whether it scrolls or

I am seeking a solution to have the background extend to the bottom of the page, while accommodating both short and long pages. <html> <body> <div id="container">Container of variable height</div> </body> </htm ...

Make sure to align images and comments seamlessly on your website just like in the comment section of YouTube

Looking for help aligning an image and two spans in one row <img src="../images/profile/profile.png" class="img" /> <span class="name">First Name</span> <span class="comment"> This is simply dumm ...

Retrieve an array object containing specific properties using axios

Currently, I am retrieving JSON data from an API call using axios and displaying it through Vue. This snippet shows the JSON Object logged in the console: 0: category_id: "categ1" item_name: "item1" price: 100 stock: 155 1: c ...

Issue with rendering Html Element on FireFox compared to Chrome

Having some trouble with an individual component (a simple dropzone) while testing on Firefox. It seems to work fine on Chrome, and the CSS looks good. Css .container { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); wi ...

Rotating 3D cube with CSS, adjusting height during transition

I'm attempting to create a basic 2-sided cube rotation. Following the rotation, my goal is to click on one of the sides and have its height increase. However, I've run into an issue where the transition occurs from the middle instead of from the ...

Achieve full height for the span tag within a div using CSS styling

I am facing a particular scenario: In a bootstrap row with 2 columns: - the first column contains a table with a button to add new rows - the second column has a label and a span (although it doesn't have to be a span) Both columns have equal hei ...

Securing Azure B2C user access with Auth Flow using PKCE, MSAL v2, Vue.js, & Azure Functions

Our application utilizes Vue.js, Azure B2C Tenant, and Azure Functions (C#) to authenticate users. We implement the Auth Flow with PKCE and utilize the MSAL v2 library on the front-end, specifically the npm package @azure/msal-browser for MSAL. The challe ...

Sort through a list of items by the key input when characters are removed from the input field, ensuring that the color remains constant

<ul class="locationlist list-unstyled"> <li> <div class="checkbox checkbox-success"> <input id="checkbox1" type="checkbox"> <label for="checkbox1"> Vijayanagar </label> </div> </li> <li> <div class=" ...

Having trouble loading CSS in Firefox?

After creating a basic responsive website, I encountered an issue where Mozilla was not loading the CSS properly when the site was hosted on my server. Interestingly, the CSS loaded fine on Chrome and IE when viewed from my computer. Here is a snippet of ...

What is the reason for the error message "vue","v-for","item is not defined"?

Here is my code in HTML. I am encountering an issue when using 'v-for' where it says 'item is not defined'. <form action=""> <div class=" form-group"> <tr> &l ...

Transform the *.svg image source into inline SVG for easier CSS customization

My goal is to include <img src="some.svg"> in my HTML, as inline SVG can be cumbersome and affect page load times. However, I would like to use CSS to style elements like fill:#fff. PS.: The webpage will be hosted on a nodeJS server and the co ...

Applying FadeIn Effect to Background Image on Hover

For several applications, I have utilized this jQuery code that swaps images with a smooth fading effect. It's incredibly straightforward. $(document).ready(function() { $("img.a").hover( function() { $(this).stop().animate({ ...

In Vue, components will trigger a rerender when there is a change in unrelated data properties, but only if the prop is sourced from a method that returns an

(Using Vue 3 with the options API) The issue at hand is that components are unnecessarily rerendering. Current Scenario: Components receive a prop value from a method. The method cannot be replaced with a computed property as specific operations are nee ...

Tips for styling custom buttons within the active editor popup of tinyMCE using CSS

Looking to enhance my tinyMCE active editor popup with custom CSS. Check out the screenshot provided for reference https://i.sstatic.net/vdVDF.png. Below you can find the code snippet used as a reference: tinymce.activeEditor.windowManager.open({ tit ...

How to center a full-screen image using CSS with maximum height

As I work on creating a stylish image viewer resembling a gallery, I'm determined to position the image at the center and middle of the page. If the image is smaller than 100% of the page, achieving this alignment becomes as easy as using table and t ...