question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS for input can't be overridden

See original GitHub issue

Hi there, I have an input inside of a menu Item and because of the !important from the Semantic UI CSS package I am unable to override the padding-right. I’ve tried adding my own custom class to the input and setting padding-right: 0em !important but to no avail.

the CSS I’d like to override:

.ui.icon.input input {
    padding-right: 2.67142857em !important;
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etshycommented, Feb 27, 2019

@juliehutchinson001 If you can’t modify variables and don’t want to use !important, the only way I know is to add multiple times a specific class to add “importance” to your rules. Like you can see in @jlukic example here

.ui.icon.input.input input {
  padding-right: 1em !important; /* some new value */
}

You can get rid of the !important here and add lots of .input.input etc. (or another class ofc)

You may need to add a lot of them to override an existing !important though, so it’s quite ugly too.

If someone have another way to do it, I’m curious too.

1reaction
itsashis4ucommented, Apr 26, 2017

You’re not supposed to touch the framework’s CSS.

@raptoria Exactly, I don’t understand why we should be changing the source code. That is definitely an anti-pattern.

Currently, I’m using Sass as a preprocessor. Is there any way I can do it without using CSS modules?

Read more comments on GitHub >

github_iconTop Results From Across the Web

css: overriding input[type="text"]
The problem is that pseudo classes count as a class. So [type=text] (a pseudo-class) has equal specificity to .small, and then the width:200px ......
Read more >
Find invalid, overridden, inactive, and other CSS
The first thing to do is inspect the element and make sure that your new CSS is actually applied to the element. Sometimes,...
Read more >
How to Override CSS Styles
How CSS overriding works, what is the cascading order and inheritance, what are the priorities and some tricks to override them.
Read more >
CSS Overriding Variables
When we use var(--blue) inside this selector, it will use the local --blue variable value declared here. We see that the local --blue...
Read more >
Specificity - CSS: Cascading Style Sheets - MDN Web Docs
Reduce the specificity of the selector you are trying to override. All these methods are covered in preceding sections. If you're unable to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found