i have code html
<button onclick=location=URL>Refresh</button>
how is code given css color?for example as below
CSS code `
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 8px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button2 {background-color: #008CBA;} /* Blue */
` in html
<button class="button button2">Refresh</button>
but if implemented in this code
<button onclick=location=URL>Refresh</button>
an error occurs
can anyone help me with this?
you must change 2 things:
"
around the javascript. like<button onclick="location=URL" >Refresh</button>
class="button"
. like this:<button onclick="location=URL" class="button" >Refresh</button>
or, you can use other think in style: instead of .button{ ... }
, use button{ ... }
.