While using tailwind, is it possible to change the pseudo-class-variants to be shorthand?
For example:
.hover:bg-blue-500 would be .h:bg-blue-500
I think this would greatly decrease the string length of a class attribute.
It is not possible by default.
You probably should write a custom plugin to add your variant
https://tailwindcss.com/docs/configuring-variants/
Related
My Razor component populates a number of divs to a container.
Is it possible to inherit the table-stripe color and apply it to my divs (odd) rather than overriding it?
Or, if I declared a new CSS class "Div-Stripe-Row".
Is it possible to reference the background-color from Bootstrap's table-striped background-color (use what's already there) rather than declaring a new color (overriding it by just copying what the color is)?
Your question may be a duplicate of this one.
Unless you want to use LESS, I would recommend adding a class to those divs and copy the styles of the Razor component to that class.
Unfortunately, CSS does not provide 'inheritance' in the way that programming languages like C++, C#, or Java do. You can't declare a CSS class and then extend it with another CSS class.
However, you can apply more than a single class to a tag in your markup ... in which case there is a sophisticated set of rules that determine which actual styles will get applied by the browser.
See https://stackoverflow.com/a/1065476/3842598
The accepted answer says:
There are tools like LESS, which allow you to compose CSS at a higher level of abstraction similar to what you describe.
Less calls these "Mixins"
...
See https://stackoverflow.com/a/1065476/3842598
I'm using the Notes 9 extension library application layout control and I would like to use CSS to float the place bar actions on the left instead of the right.
Those actions are styled with the lotusBtnContainer class using a float:right property. How do I override that class with my own class that uses a float:left?
I can make the adjustment to the lotusBtnContainer class in firebug but I don't want to touch that class for obvious reasons.
Quick answer: cascading. If your stylesheet is below the stylesheet that defines lotusBtnContainer, then it will override the styles above it. You should be able to add a stylesheet to the page that contains the same definition. One caveat is that you must match the specificity of the lotusBtnContainer definition in the theme stylesheet. If the css definition is td.lotusBtnContainer then in order to override you must also use td.lotusBtnContainer, not just .lotusBtnContainer.
If you need any additional help with this, please add the definition of the lotusBtnContainer from the default css files and I can assist further.
Edit: Additionally, if this doesn't work, adding the class with the style you want like this should override:
.lotusBtnContainer{float:left !important;}
Is there a way to apply a class to a set of nodes matching a CSS selector, inside the actual stylesheet?
This is of course possible in a single line of jquery, but is it possible to do in the css itself?
input[type='button']
{
// apply the class 'k-button' to these
}
Is there a way to apply a class to a set of nodes matching a CSS selector, inside the actual stylesheet?
Nope, there's currently no way of doing that with standards compliant CSS.
No,there is not way of attach class with css,but you can use this code with jquery
$(".YourClassName").addClass("YourNewClass");
best regards
No, you can't do this with CSS. You're talking about altering markup, which CSS is really not designed to do (content: rules aside). As others have suggested, I would look into the 'extend' options in SASS, or use jQuery if need be.
That all being said - why can't you copy the relevant styles from the class declaration, and paste them into your selector? Or, just tack your selector on to the class declaration?
I would like to obtain a CSS-like string from code and add it to the current widget style.
SmartGWT have a setStyleName attribute, which work with CSS present on the stylesheet only, but no set Style or anything similar I can think of. How can I achieve this?
If I understand your question correctly, you should be able to use {widget}.getElement().getStyle() to obtain a com.google.gwt.dom.client.Style object that you can manipulate. But you need to give it individual “parsed” CSS properties.
If you just have a chunk of CSS as a string you can add it to your document with com.google.gwt.dom.user.StyleInjector, then add the needed classes to the widgets that need them.
similar to to this here...
http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
i know i can change each element's style's individually, but i want to change a lot of elements styles at the same time, and the browser seems to struggle over about 40 elements.
thanks :)
Yes it can, quite easily.
$$('.someClass').addClass('newClass');
This will add newClass to every someClass element - in your case the 40 elements you have.
This is the literal answer to your question.
That said, I believe what you're really trying to do is generate a specific CSS class on the fly.
And that's something far more complicated. I suggest using this MooTools plugin: http://mootools.net/forge/p/moocss