How can I remove all attributes from any css selector? To override and reset any css id selectors?

#search-box {
-moz-border-radius-bottomleft:0px;
-moz-border-radius-bottomright:0px;
background-color:#ffffff;
border:0px solid #CCCCCC;
float:right;
padding:8px;
position:relative;
top:0;
width:20em;
}

#search-box {
/*remove all css declaration here*/
}
+5
source share
3 answers

You can not. You will have to manually reset each of them. If you need to switch between the main differences, for example, when the user clicks on an element, you can remove them from the element itself and put them in a class. So:

#search-box {
  color:blue;
}

Becomes as follows:

#search-box {
  color:red;
}
#search-box.focused {
  color:blue;
}

Now that you need to make radical changes to the display of an element, add or remove a class .focused.

+3
source

. , , . , , .

+3

The question makes sense if you use classes,
HTML

<div id="site-search-box" class="search-box">

Then reset the attributes, for example:
CSS

#site-search-box {
    position: static;
    padding: 0;
    width: auto;
}
+1
source

All Articles