I am using TailwindCSS and its Typography plugin. In particular, I am using the prose class and trying to extend it.
The full code is here: https://codesandbox.io/s/heuristic-mayer-zxw2b?file=/tailwind.config.js&resolutionWidth=700&resolutionHeight=675
The container has prose sm:prose-lg so that prose-lg is applied after the sm breakpoint. I extend the prose classes so that a default color is applied and a second color is applied to children with a particular class (the selector is "> .lighter-color").
Below the sm breakpoint, the colors are #00a and #00f, as expected.
After the sm breakpoint, the colors should be changed to #0a0 and #0f0, respectively. The first color does change to #0a0 but the second color doesn't change.
For some reason, the "> .lighter-color" selector is included in prose but not in sm:prose-lg. I think it works for prose-lg so I suspect it might be a problem about the responsive variants.
It turns out that this is an issue with TailwindCSS, as described here.
Related
Based on the documentation, Tailwind JIT (Just In Time) mode allows to add arbitrary styles.
I can't make it work for the CSS grid's grid-template-areas property. In this simple example, I just want the sider on the left, the main content on the right.
Note that I have more complex goals, I know I don't need CSS Grid for such a simple layout.
JIT mode works as using an arbitrary padding such as px-[23px] works.
The issue lies here: [grid-template-areas:'sider content'], as if you go to the CSS tab there is the same property that works if uncommented.
Here's a playground:
<div class="grid [grid-template-areas:'sider content']">
<sider class="[grid-area:sider]">SIDER</sider>
<main class="[grid-area:content]">MAIN</main>
</div>
Because there are two different classes in [grid-template-areas:'sider content']. [grid-template-areas:'sider and content'] because of the space. You must use an underscore to handle the spaces.
[grid-template-areas:'sider_content']
Output:
.\[grid-template-areas\:\'sider_content\'\] {
grid-template-areas: 'sider content';
}
Reference
How to style a row in ngx-datatable component? Here is an example in component's documentation:
https://swimlane.github.io/ngx-datatable/#css
When I run same demo only one row has background color set.
Here is my demo
In order to style properly the child component from the parent component, you can use one of the methods specified in this link. Preferably use the answer 3 in the link which will prevent the use of deprecated selector like :deep:. You can fix the color not appearing in even rows by
/deep/ .age-is-ten { background: #ffc91f !important;}
I'm trying to style mat-select's differently per component. I have 1 main select in my (always visible) header, and multiple in different components within my SPA. I'm trying to style the header mat-select differently because it has a dark background, the rest should be unstyled, and not affected by the header styling.
I've tried using ngClass & ngStyle, but they don't add the required classes to childs, just to the main class. I've tried using ::ng-deep and /deep/ but they alter the styling of components in other parts of the application. So technically they work, but with the wrong result.
https://stackblitz.com/edit/angular-kzwatd
I'm hoping to just alter the text color to white, since the background of the mat-select is dark.
Anyone have any clue why the stackblitz is not working?
Try using :
<mat-select class="main" placeholder="Main"> ....
/deep/ .main .mat-select-value{
color: red;
}
https://stackblitz.com/edit/angular-rucggb?file=src/app/main-component.css
We are using bootstrap, want to overwrite one of the bootstrap class properties as shown below. I am using Asp.net MVC.
CSS
Boot strap
Panel-heading
{
Color : Red
}
Application CSS
Heading
{
Color : Green
}
HTML Page
Link Bootstrap
Link Application CSS
Issue: Still div color is Red.
Can some help me how overwrite color of boorstrap class without using !.
This is happening because when your application is loading you are loading bootstrap file first and then your application css file, which is actually the correct way to load it.
But according to css rules if you apply two classes on an element having same style then the browser will pick the one which it finds first.
It does not depends on the order in which you have applied it on your element which means
<div class = "Panel-heading Heading"></div>
<div class = "Heading Panel-heading"></div>
changing this order does not matters, what matters is which css file gets loaded first in the browser.
One way to override it is using !important which is not a good practice.
Also having a class with same name in your application is not an elegant solution as a new developer working on your application can get confused as he would not be expecting the native bootstrap classes to work in a different manner.
The other way out is to increase the specificity of your custom class.
Application CSS
div.Panel-Heading.Heading { Color : Green }
This will increase the specificity of your class by giving it more precedence and will override the previous class
You can read more about specificity over here
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
Using Foundation 4 buttons allows you to customize design using the mixins.
This is the same for most elements.
However, there are many settings that the mixins don't expose to customization, e.g.:
Font color
Hover effect
Border color
These are all calculated based on the button background color.
The button is just an example, but I have the same issue with all other elements.
Is there a recommended way to customize parts which are not exposed by the mixin?
I don't want to go into the source and change the actual mixin definition.
If my design spec is very different from Foundation defaults, would it be better to not use Foundation?
Almost every setting can be customized using SASS variables. The most common ones are accessible in _variables.scss, but you can overwrite any of the other variables used in the actual component SCSS files.
For values that don't already have variables, you can override the styles using CSS and include the overrides in a wrapper mixin. Ex:
#mixin my-button-style($bg:$primary-color, $radius:false, $disabled:false) {
#include button-style($bg, $radius, $disabled);
/* CSS overrides go here */
border-color: pink; /* etc */
}