-1
width:16.5%;
float:left;

If I have a CSS property set to the code above. How do I "reset" it?

I want to have it with no float and no width setting. Do I use initial or inherit?

@media (max-width: 475px) and (min-width: 320px) {
#myid {
width:initial;
float:none;
}
}
Mykola
  • 3,343
  • 6
  • 23
  • 39
canon819
  • 5
  • 1

4 Answers4

1

According to https://www.w3.org/TR/css3-values/#common-keywords :

The initial keyword represents the value specified as the property’s initial value. The inherit keyword represents the computed value of the property on the element’s parent.

You can use initial if you don't need IE support - http://caniuse.com/#search=initial

But if you need you can refer to default value at w3schools.

Default width property value is auto - http://www.w3schools.com/cssref/pr_dim_width.asp

Default float property value is none - http://www.w3schools.com/cssref/pr_class_float.asp

Anton Gusar
  • 513
  • 1
  • 3
  • 14
0

You can't reset it cross browser without knowing what its initial value should be, unfortunately. You would need to consult the spec and see what the default values are for the properties.

initial is not supported by IE.

alex
  • 479,566
  • 201
  • 878
  • 984
0

You would restart it like this:

#myid{
 width: auto;
 float: none;
}
Maverick
  • 876
  • 2
  • 12
  • 22
0

It depends on the parameter you are setting. For your case the following would work:

#myid {
  width:auto;
  float:none;
}

You should consider the browser support when using certain values.

James
  • 2,013
  • 3
  • 18
  • 31