How to combine checked and after css selector on radio and checkbox input? - css-selectors

Is it possible to have selectors like this in CSS?
input[type="radio"]:checked::before {
background-color: red
}

Is it possible to have selectors like this in CSS?
Pseudo-elements can only be on elements that have opening and closing tags. The input element does not have such tags, therefore, there cannot be a pseudo-element

Related

How to limit the height of MUI Autocomplete input box

I am having trouble in limiting the height of MUI Autocomplete component. When I select the value from the list it automatically add empty space or row at the bottom of input which I do not want.
Below is my example.
https://codesandbox.io/s/mui-5-forked-n8nc6i?file=/src/App.js
screenshot
If you want to bypass the default css style from MUI, then you can use inside your css the following:
.MuiAutocomplete-inputRoot {
flex-wrap: nowrap !important;
}
example

Is there a way to target some reac-bootstrap component css?

Is there any way to target some components from react-bootstrap in CSS. For my application, I'm using Modals from react-bootstrap and I need to change some style on all of them and it will be annoying if I need to change every single one individually.
Yes, it is possible, however you will need to inspect the Modal using ChromeDevTools or the like and see what classes are applied to the Modal when it is displayed. For example, when I inspected the Modal from react-bootstrap, I noticed the styles applied to the heading were given the className of "modal-header". So I created a Modal.css file and added the following code to it:
.modal-header {
background-color: red;
}
Then, I imported "./Modal.css" into the Modal.js file or wherever you've defined or using your Modal. Finally, when I opened the Modal, the heading had a background of red color so to speak.
Please note that it can be a little difficult to override bootstrap styles sometimes.

react-select does not display with column-count

I have a bunch of react-select components on the screen. They are all inside a div with a class called bookData. The css for bookData is:
.bookData{
font-size:13px;
column-count: 2;
column-gap: 20px;
padding: 10px;
}
If I select something with react-select, the selection does not show up. If I remove column-count, my code for react-select works find, it will select items and display. Is there css, I can add that will allow react-select to work with column-count?
This CodeSandbox could help you: https://codesandbox.io/s/4jr596lr09
All you need to do is to wrap the two column content in a div displayed by flex.
Wrap the two elements in a div and set the flex value to 1 (Ref: What does flex: 1 mean?)

React-bootstrap Component Font Size

I wanted to manually changed the font size for a ReactJS project. I tried to add something like
* {
font-size: 10px;
}
and that works with everything that is a plain text. However, every component from react-bootstrap (e.g., DropdownButton, Panel) remains a large font size. Thus, what is the correct way to change the font size for those react-bootstrap components to the same as for other plain text? Inline styling works but I would like the changes to apply to a .css file. Thanks!
Edit: Panel Header code snippet:
<Panel>
<Panel.Heading>
<Panel.Title>
title here
</Panel.Title>
</Panel.Heading>
...
To change the font-size of all text in your project, use
* {font-size: 10px;}
Alternatively, you can pass a style prop to a component, EX: <Panel.Body style={{fontSize: 10}}
It's simple you can add style={{fontSize:"10px"}} inside the jsx button or any element, this will directly apply to your jsx element and bootstrap default won't work.

AngularJS Conditionally Remove CSS Hover

Is there a way to remove the :hover from a css inline in angular without removing the whole class?
Like the following removes the whole class:
ng-class="{'option-selected' : option.chosen}"
But say option-selected had a option-selected:hover
Is there a way to remove :hover inline within the ng-class?
Attach the hover to another class that you can toggle.
Somethign like
ng-class="{'option-selected': option.chosen, 'option-hover': option.hover }
Then in your css for when setting up the hover you would have
.option-selected.option-hover:hover{
...
}
That way, the only way the hover will work is if both classes are on it.
Besides that, no there is no way to get around the hover from css unless you start dropping in !important's everywhere.

Resources