Javascript - lock css rule [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there any concrete way to lock a css rule on an element to be sure it cannot be altered or changed from the browser?
I put a webkit filter on an element abd i would like this to be not altered or removed but afaik is not possible...?!
Or any way to trigger js to get element css rule to stay also if edited from a person by browser !?

You can use the !important CSS rule to make sure none of your other CSS rules override something, for example:
p {
color: red !important;
}
This would ensure all p tags get colored red, and that nothing with a higher priority changes the color to something else.
There is no way to prevent a user from altering HTML, CSS or Javascript from their browser.

Related

How to make accordion on clear css without bootstrap and html? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 25 days ago.
Improve this question
I can't build accordion on clear css
I have tried a lot of things, but I still can't do it
You can't.
In fact you cant make pretty much anything without HTML (As for Bootstrap is 'just' a wrapper for HTML, CSS and JS.). HTML says where what element is, aka. places the content. CSS defines how it looks and behaves (for the later, you also may need JavaScript).
An accordion in fact needs all three (See this question/answer.)

Change a value of existing class with JavaScript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is it possible to change the value of a property of an existing CSS class using vanilla JavaScript?
To elaborate, I have a button item in a form, that is styled purely with CSS file. Is there a way to modify the class that applies the style to the item using vanilla JavaScript?
Or should I create a separate class and replace the currently applied class? I think this second option would be the cleanest way, but I was wonder if the first way is actually possible.
You can use inline style attribute
Example document.getElementById('someElement').style.color ='red'
As far as I understand your question you want to make a change in a CSS class itself not to change CSS properties of an element.
It is not possible to do so.
You can either change an element class or component styling via an element.style property

Disable a nicescroll scroll bar, which is coming by default [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am getting a nicescroll scroll bar ( red colour), by default, which is causing my html page to break when Zooming in.How to disable it.
The key horizrailenabled value is globally set to true, in the _globalobjects object. You can set the value to false which will disable the Nicescroll functionality, leaving the native scroll in place.
This recommendation is directly from Nicescroll Issues Resolution
$("#yourscrollableelement").niceScroll({horizrailenabled:false});
To disable the native scroll with quoted key add this line:
$("#yourscrollableelement").css({"overflowX":"hidden"});
Though this is a solution, I would recommend viewing the Nicescroll code to determine what is causing issues with your mark-up. Often times, you can solve the issue by adjusting your code.
If you pull the nicescroll.js file into your editor, search/find HORIZ. This will most likely be where the conflict is occurring. My guess, the variable cursor css property position: absolute; is the culprit. Then you can adjust your styling and maintain functional integrity with the Nicescroll library.

Button VS a-tag [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In our application we use A-tags to create all custom styles elements, such as custom CSS buttons.
We alter the A-tags with our CSS and set href='javascript:void(0)'.
The main problem is with Chrome showing the bottom label 'javascript:void(0)' on hover.
Can we just switch all A-tags to button, or is there some major drawback we have consider?
Thanks...
You shouldn't be using an anchor tag in the first place if your anchor tag doesn't point to a URL and is being used as a button. That's sort of like wrapping your text in <b> tags and making it italic.
Making your HTML semantically correct is a good practice, so no, there are no downsides aside from dealing with browsers' default styles for the <button> element.

Is it possible to make elements ignore the re-size of an element not using position:absolute? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I would like to know if there is a reasonably efficient way to make elements in a <div> ignore an element being re-sized next to them (by not moving with it) and the element is not position:absolute. I thank anybody in advanced who is willing to help me!
If you have properties you want the element to override you can try !important after the property. It will make properties take precedence over parent elements, and many times you'll get the desired effect. This is good if you need to apply a change quickly, but is not ideal. Ideally, you'll have the parent set up to let the children flow from it.

Categories

Resources