It seems like you are mistakenly applying the background-color
to your link instead of the button. This is causing only the link to have the background color, not the entire button.
Keep in mind that structuring your code in this way is not recommended. It's best to make your link resemble a button or use an onClick
event handler on the button to properly redirect users. Avoid nesting a link inside a button as it can negatively impact accessibility for screen readers and may result in poor website/application scores.
Here is a suggested solution:
function onClick() {
window.location.href = "#";
}
.link {
text-decoration: none;
background-color: red;
padding: 5px 15px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
.btn {
border: none;
background-color: red;
padding: 5px 15px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
<td><a href="#" class="link">OCR</a></td>
<td><button class="btn" onClick="onClick">OCR</button></td>
For resolving your issue, consider adopting the following approach:
.block0 {
border: none;
background-color: red;
padding: 5px 15px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
.link0 {
text-decoration: none;
}
<td><button class="block0"><a href="/update_ocr/{{ row.0 }}" class="link0" value="{{row.3}}">OCR</a></button></td>