Angular mat-error not taking up its own space - css

I have a form with mat-errors that I'm trying to space out. I know I can simply space out the form fields themselves, but I've been trying to add margin/padding/border to mat-error elements, and they all get applied, but they don't move.
As far as the CSS goes, I've tried most things I can think of to force it to move. The styles are applied but nothing is actually changing.
mat-error{
display: block !important;
position: relative !important;
margin-bottom: 40px !important;
padding-bottom: 40px !important;
z-index: 999;
}
Why is this happening?

Change your css to class: .mat-error instead of mat-error.
In order to change styles in angular materials you should define a global stylesheet declared in the styles array of your angular.json configuration file. and custom all mat styles within.
In Styles.css:
.mat-error {
color: aqua;
}
The result will be:
Please read Customizing Angular Material component styles article for better explanation.

Related

Removing default padding on Vuetify v-app-bar

Vuetify v-app-bar has default css classeses v-toolbar__content and v-toolbar__extension that adds 16px padding on x-axis and 4px on y-axis that I want to get rid of.
I have tried overriding these classes in my css like below
.v-toolbar__content {
padding: 0px !important;
}
But it doesn't work. Anybody aware of some trick that would help get rid of the padding in v-app-bar?
In scoped styles, you cannot access child components directly. You need to use deep selector like this.
/deep/ .v-toolbar__content {
padding: 0px !important;
}
Or if you want to target using child selector, you can do:
.parent-class >>> .v-toolbar__content {
padding: 0px !important;
}
I recommend modifying the vuetify SCSS variables.
According to the v-toolbar API we can modify $toolbar-content-padding-y and $toolbar-content-padding-x in our variables style file.
$toolbar-content-padding-x: 0;
$toolbar-content-padding-y: 0;
If you haven't configured a variable file, please follow the SASS variables guide.

How can i override previous styling in a wordpress theme?

Ok, this is the styling I want to be used
.suggestion-taxonomies-product-visibility span {
display: inline-block;
float: left;
padding-left: 10px;
}
The usual of mentioning the element here doesn't seem to work, any ideas? I can specify more if need be. I am new and not great at specifying my problem!
Thanks.
use important like
.suggestion-taxonomies-product-visibility span {
display: inline-block !important;
float: left !important;
padding-left: 10px !important;
}
Place your style after the theme stylesheet. It will override the theme styling. Better still, you can replace the suggestion-taxonomies-product-visibility class span styling in the styles.css file. If you opt for the latter, changes will be lost when updating the theme. You can avoid this by building a child theme to the theme you are currently using.
Use !important tag in each, ex:
.someclass {
width: 10px !important;
}

Disable a css rule in the style chain

I have a small problem and I'm not sure there is a real way to do what I want easily.
I have multiple stylesheets available:
a Bootstrap stylesheet is loaded first
Multiple modules are loaded
In one module, there is a rule like this:
.container .container {
padding-left: 0px;
padding-right: 0px;
width: auto;
}
This effectively prevent me from using stacked containers in my layout. I'd like to disable this rule.
I can technically override it before or after it is declared but I don't want to reset the styles... Let say I just want this rule to cease to "work".
I tried to override it with:
.container .container {
padding-left: inherit !important;
padding-right: inherit !important;
width: inherit !important;
}
But that doesn't work. What I'd like to achieve is effectively disable a style in the stylesheet chain since the bootstrap has multiple styles with media queries, it could be a bit complicated to reapply the bootstrap styles for the container after the css stylesheet that breaks my styles is loaded.
As far as I know there is no way to do that other than reapplying the styles.

cannot override a css

Ok so I have this scenario that I don't understand in the default bootstrap css style sheet the label css is defined like this
label {
display: block;
margin-bottom: 5px;
}
Now I override this css in my own stylesheet which is rendered after the bootstrap like this
label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
color: #333;
}
Can someone explain me why is browser is still rendering as a display:block?? even if the styles are well defined are good rendered? here's the screen shoot the computed styles
Here's the proof of the override of the style
Update, this is how is rendered the stylesheets
You need to import your CSS code after Bootstrap that way it will get overwritten.
As pointed out, you can just use "!important" however, this is usually bad practice.

Does Reset.css affects other stylesheets?

I am starting a new project, so i thought to start using Reset.css in my projects. i got the concept of using Reset.css, but one thing is bothering me is that does if affects my other style applied on the same element.. like in reset.css div have 0 margin and 0 padding... and if i apply margin to some of the divs in my stylesheet, wont it get disturbed?
Please clear my this doubt
Not if the style applied to your other divs is more SPECIFIC.
http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
In general any style applied using a class, or an id in the selector is going to take precedence over one which doesn't. But there are many other rules in this area you should become aware of.
i.e.
div.myStyle {...}
will always overrule
div {...}
You have to include reset.css first and then include your own stylesheet file. and be sure that your styles wont be overwritten by reset.php.
What you neeed to do is load reset.css as a first style sheet.
Anything else loaded after it will be overriding reset.css
e.g if you specify in reset css: p { margin: 0px; padding: 0px}
and than load style.css with style: p {margin: 2px; padding: 2px}
The style load as last one will be used.
I personaly use technic with
* { margin: 0px; padding: 0px; border: 0px; outline: none; list-style: none;}
Put it at the top of css file and job done:) No need for extra .css fil.

Resources