How can I stop next/link from changing css styles?
Answered
!=tgt posted this in #help-forum
!=tgtOP
I'm using next/link on a glui card component and whenever I use it as a parent of the
Here's the code below:
Card
component, it messes up css styles.Here's the code below:
{Object.keys(images).map((image) => {
const { friendlyName, description, icon } = images[image];
return (
<Link href="https://google.com" className="" passHref key={image}>
<Card
key={image}
className="flex gap-2 justify-between w-96 h-36 bg-bg-darker"
>
<Image src={icon} alt={friendlyName} width={96} height={96} />
<div className="flex flex-col justify-center">
<p className="text-text-primary font-bold text-lg">{friendlyName}</p>
<p className="text-text-secondary font-medium">{description}</p>
</div>
</Card>
</Link>
);
})}
11 Replies
You're going to have to override all the default styles that come with a tags
I'm guessing you've got blue text
and an underline
you can set
text-decoration: none
and color: black !important
Look here if you want to see all the defauly styles for a tags. https://www.w3schools.com/cssref/css_default_values.php
What weird styles are you getting
!=tgtOP
Ok I managed to fix the issue by changing the nesting
Answer