I have a button that I try to center but it doesn't work. I tried changing the margin to 50% but it's not exactly in the center. I tried to do what in my code below also don't want always steek t the left
.openAllButton {
background-color: #4caf50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
font-size: 16px;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
border-radius: 10px;
}
const ResultGrid = ({ resultGrid = [] }) => {
const openInNewTab = (url) => {
console.log("inFunction");
var win = window.open(url, "_blank");
};
const handleOpenAll = () => {
resultGrid.forEach((result) => {
openInNewTab(result);
});
};
return (
<div className='result'>
<button className='openAllButton' onClick={handleOpenAll}>
Open All
</button>
<Card>
<table>
<tr>
<th>links</th>
</tr>
{resultGrid.map((result) => (
// <div className='result'>
<tr>
<td>
<a href={result} target='_blank'>
{result}
</a>
</td>
</tr>
))}
</table>
</Card>
</div>
);
};
How can I center it?