Change element text inside dropdown Semantic UI - css

I'm using dropdown from react.semantic.ui and also custom some css attribute inside the dropdown,
<Dropdown
scrolling
className={styles.filterDropdown}
placeholder="Select Area, Branch or Region"
fluid
search
selection
closeOnChange
onChange={handleChange}
searchInput={<Input transparent className={styles.inputSearch}></Input>}
options={[ALL_OPTION].concat(areaList({ areas, headOffice }))}
value={codeValueRating}
/>
but there is a div element inside the dropdown with class name 'text' that i could not change. It look like this from element inspect
https://i.stack.imgur.com/f2sQv.png
i have try to change it directly using solution from this link here but it still not make any changes, this is one of my solution i have try inside my css code
.ui.selection.visible.dropdown>.text:not(.default) { color: #475fe8 !important; }
and also this one :
.filterDropdown {
flex: 1.8;
cursor: pointer;
word-wrap: break-word;
line-height: 1em;
white-space: normal;
min-height: 2.71428571em;
background: #2C3245 !important;
padding: .78571429em 1em .78571429em 1em;
border: 1px solid #FFFFFF !important;
color: #FFFFFF !important;
border-radius: .28571429rem;
min-width: 15rem !important;
div.text {
color: #475fe8;
}
}

Related

Class Link works for what I am doing, however, it changes styling of all links on site

I have a site in Wordpress where I am inserting a block with html.
This is the inserted html code:
<div class=“options-bar”>
<a href="https://total-speed-customs.myshopify.com/?" class=“options-bar-btn”>FUEL INJECTORS</a>
<a href="https://total-speed-customs.myshopify.com/collections/ignition" class=“options-bar-btn”>IGNITIONS</a>
<a href="https://total-speed-customs.myshopify.com/?" class=“options-bar-btn”>BOLTS</a>
<a href="https://total-speed-customs.myshopify.com/collections/e85-fuel" class=“options-bar-btn”>ELECTRONICS</a>
<a href="https://total-speed-customs.myshopify.com/collections/trailer-parts" class=“options-bar-btn”>WINCHES</a>
HITCHES
</div>
This is in the theme.css stylesheet at the very bottom:
.options-bar {
text-align: center;
}
.options-bar-btn, a { display: inline-block;
color: white !important;
text-decoration: none;
background: black !important;
padding: 10px 20px;
margin: 0px 5px;
border-radius: 6px;
text-align: center;
font-size: 22px;
}
#media screen and (max-width: 500px) {
.options-bar-btn, a { display: inline-block;
color: white !important;
text-decoration: none;
background: black !important;
padding: 3px 3px;
margin: 0px 1px;
border-radius: 3px;
text-align: center;
font-size: 10px;
}
}
It works for the inserted block html, but it also changes the styling of links sitewide. I've enclosed a link to the site in progress to show the row of buttons working correctly, but the top nav has the same styling, which needs to just be transparent for the logo and the main nav.
What I'm missing?
https://total-speed-customs.myshopify.com/
Your expression .options-bar-btn, a {...} means the following: set the following styles to all elements that have class options-bar-btn and to all tags a as well.
The comma in your code is a separator between two rules.
When you need to set a rule for an element that is a child of an element with class options-bar:
.options-bar a {
color: white !important;
}
This will select all a tags inside the elements with class options-bar.
If you want to change a style of all the links with class options-bar-btn:
a[class*="options-bar-btn"] {
color: white !important;
}
This will select all tags a then filter elements that has options-bar-btn class set.

Fit 'a' element to button size

Well, I have two buttons (in Spanish) and these buttons are inside an 'a' (link tag) so that:
<div class="MB789">
<button class="B121">Ya soy miembro</button>
<button class="B122">Quiero unirme</button>
</div>
The purpose of the 'a' is obviously to redirect the user to the respective page and the buttons are for the style (yes, I want the user to see buttons and not links)
In the CSS I wrote the following:
.MB789{
display: table;
padding: 10px;
text-align: center;
}
.MB789 button{
border: none;
border: 1px solid black;
padding: 10px 20px;
margin: 10px;
cursor: pointer;
}
.MB789 a{
margin: 10px;
background: red; /*Debug: to visualize the elements 'a'*/
}
This is the result:
And that's the problem, that the 'a' elements stand out from the buttons.
And this is what happens when I tell the elements to show themselves as a table.
.MB789 a{
display: table;
background: red; /*Debug: to visualize the elements 'a'*/
}
Then this is what happens:
What I want is that 'a' elements do not protrude from the buttons, but that when the user click on a button, be redirected to the respective link.
Note: I know that Javascript can be redirected, but I refrain from doing this using that language because the user can disable Javascript from the browser settings.
Firstly, you cannot nest <button></button> elements inside an <a> tag, that is invalid markup. Please see why here: Can I nest a <button> element inside an <a> using HTML5?
Secondly you can style the <a> tag like a button and this will resolve your problem.
Your HTML markup needs to look like this:
<div class="MB789">
Ya soy miembro
Quiero unirme
</div>
Your CSS would look like this:
.MB789{
display: inline-block;
padding: 10px;
text-align: center;
}
.MB789 a{
display: inline-block;
border: 1px solid black;
padding: 10px 20px;
margin: 10px;
cursor: pointer;
}
You've put a 10px margin on the buttons, because they're inside of the a tags this margin will be between the buttons and the edge of the a tags, making them protrude out from the button. Try removing that margin:
.MB789 button{
border: none;
border: 1px solid black;
padding: 10px 20px;
cursor: pointer;
}

CSS styling to display word properly in span

I have used below template to generate HTML, Now the problem is when I resize the window then text in the span not showing correctly, In given screenshot "aborted" word is broken down in two lines which not what I expected. How do I fix this issue?
template: _.template([
'<div class="notes">',
'<label class="control-label"><%=label%>:</label>',
'<span><%=text%></span></div>'
].join("\n"))
CSS:
.notes {
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 3px;
color: #333;
display: block;
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
font-size: 12px;
line-height: 1.42857;
margin: 0 0 10px;
overflow: auto;
padding: 5px 10px;
word-break: break-all;
word-wrap: break-word;
}
div.notes label.control-label {
min-width: 0px;
}
Below is Screenshot from my HTML page.
It looks like you have white-space set to pre-wrap. You need to check if the whole code is injected inside <pre> or you need to reset the white-space property by:
span {white-space: normal;}

Background image for submit button not working

My first background image for the form fields works, but the second one for the submit button is doing nothing, & the button is using the style of the fields.
My CSS is this:
form input {
background: url("images/text-field1.png") no-repeat scroll -5px 0 transparent;
font-size: 1em;
height: 17px;
padding-top: 4px;
padding-bottom: 4px;
padding-left: 4px;
width: 311px;
margin-bottom: 5px;
margin-left: 40px;
}
form input .button1 {
background: url("images/submitbutton.png") no-repeat scroll -5px 0 transparent;
}
button1 is a class that only styles the button, but for some reason it is not styling it.
Try below code.
I have given button class name mybtn and applied background-image style.
HTML
<input type="submit" name="submit" class="mybtn"/>
CSS
input.mybtn {
background-image: url("http://subtlepatterns.com/patterns/symphony.png");
font-size: 12px;
padding: 10px;
}
JSFIDDLE DEMO
You need to add !important
otherwise, the base class, which uses !important on it's default EMPTY background-image property will override you.
you will need something like
background-image: url("images/submitbutton.png") no-repeat scroll -5px 0 transparent !important;

The placeholder text in my text boxes is mis aligned in chrome

I've got a problem in Google chrome where the placeholder text sits too high on my website
http://www.myinvestmentdecision.com.au
Click "Feedback" and you'll see the text in the placeholder sits to high. I've got a placeholder script, but it turns off when it realises that chrome has support for placeholder.
Just to proove that point here's a jsfiddle of the form itself: http://jsfiddle.net/RAANa/
Must be a CSS thing. Any ideas?
Remove line-height:28px from your css below.
.form input[type="text"], .form input.text, .form .calculate_box .calc {
background: transparent url(../images/input-background.png) repeat-x left top;
border: 1px solid #A1A1A1;
margin-left: -1px;
height: 28px;
line-height: 28px;
display: block;
width: 284px;
}
See attached screenshot with line-height removed
I think your line-hight:28 from here: (form.css)
.form { font-family: arial, sans-serif; }
.form input[type=text],
.form input.text,
.form .calculate_box .calc{
background: transparent url(../images/input-background.png) repeat-x left top;
border: 1px solid #a1a1a1;
margin-left: -1px;
height: 28px;
line-height: 28px;
display: block;
width:284px;
}
Is causing the problem. Remember that this declaration applies to the content of the tag, as well as the tag itself. This can get you when it comes to forms..
Not sure if this is the "right" way to do it, but adding a padding of 5px to the input field would center the placeholder for the email field.
Just add this to your CSS wherever it applies to that email field:
padding: 5px;

Resources