Styling Vue.js router links with the CSS property

I need help changing the default CSS properties for text within a router-link tag. Currently, the text is purple with an underscore and I want to modify the font, size, and color but I'm not sure where to focus in my CSS. I have already attempted using "text-decoration: none" within the .sidebar-buttons button CSS element.

Here is the current design that I want to update.

.sidebar {
  grid-area: 2 / 1 / 6 / 2;
  background-color: grey;
}
.sidebar-buttons button {
  background-color: white;
  border-radius: 12px;
  width: 40%;
  height: 7vh;
}
.sidebar-buttons button:hover {
  box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.5);
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
}
<div class="sidebar">
  <div class="sidebar-buttons">
  <hr />
  <button>
    <router-link to="/">Home</router-link>
  </button>
  <br />
  <button>
    <router-link to="/clothes">Clothes</router-link>
  </button>
  <br />
  <button>
    <router-link to="/skate">Skate</router-link>
  </button>
  <br />
  <hr />
  </div>
</div>

Answer №1

Success! After some experimentation, I was able to get it to function properly. I ended up enclosing the text inside the router-link tag within an a-tag and then applied CSS styling to the a-tag. Hopefully, this solution will be beneficial to someone in the future!

.sidebar {
  grid-area: 2 / 1 / 6 / 2;
  background-color: grey;
}
.sidebar-buttons button {
  background-color: white;
  border-radius: 12px;
  width: 40%;
  height: 7vh;
}
.sidebar-buttons button:hover {
  box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.5);
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
}
.sidebar-buttons button a{
  color: black;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
}
<div class="sidebar">
  <div class="sidebar-buttons">
  <hr />
  <button>
    <router-link to="/"><a>Home</a></router-link>
  </button>
  <br />
  <button>
    <router-link to="/clothes"><a>Clothes</a></router-link>
  </button>
  <br />
  <button>
    <router-link to="/skate"><a>Skate</a></router-link>
  </button>
  <br />
  <hr />
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

In need of styling text using CSS?

Despite setting the CSS to .text { word-wrap : break-word; max-width: 100px}, the text is not wrapping as expected. It is still displaying in a single line. I am anticipating that the large text should wrap onto the next lines. ...

Is there a way to dynamically update text using javascript on a daily basis?

I am currently developing a script to showcase different content and images every day. While I have successfully implemented the image loop to display a new picture daily, I need assistance in achieving the same functionality for the title. My aim is to c ...

What's the best way to create a unique shape for a Bootstrap div?

Can someone assist me in configuring the bootstrap div col-xs-2 to match the layout shown in the images provided? Your help would be greatly appreciated! Thank you in advance. https://i.stack.imgur.com/afd0p.png https://i.stack.imgur.com/0BGum.png ...

Separate your buttons with style using the Bootstrap button groups with

Is there a way to add border line separators between buttons in Bootstrap button groups? <div class="btn-group" role="group" aria-label="Button group with nested dropdown"> <button type="button" class=&quo ...

The Vue PWA login feature operates smoothly during development, however, encounters a 401 error when in

I currently have a Vue.js PWA connected to a Django Rest Framework backend that functions properly on my laptop when accessed through a browser. However, upon deployment to production, the app continues to work seamlessly when logging in via a browser, ...

When website links are clicked, they receive an unusual border

Encountering issues with CSS on all links. After clicking on a button/link, an unusual border appears (refer to image). Checked all CSS files and did not find any classes associated with this color. View screenshot here ...

The specified module could not be located in the directory

After removing some unnecessary files from my project, I encountered an error that caused multiple issues throughout the project. The following image illustrates the problem: https://i.stack.imgur.com/XKkOQ.png I am unsure of how to resolve this issue. A ...

creating an interactive table with the help of the useState hook

I'm new to JavaScipt and ReactJS, so I have a question that may seem obvious but I can't seem to figure it out. I am attempting to display my array in a table using useState, but currently I can only show the header. Additionally, if anyone know ...

Leverage Pinia store in Vue helper functions

I have been working on my Vue.js application and I am looking to implement some helper functions that will utilize a Pinia store within the app. These functions need to be accessible by multiple components. Should I define these helper functions directly ...

a single column with a div of varying height using flexbox

I need to create a div with a height of 120px using only the CSS property display: flex. I am not allowed to use float and can only use div elements. Here is the code I have so far, but I'm unsure how to achieve the desired outcome: .flex-containe ...

Show blob file as a PDF document in a popup or dialog box using HTML and TypeScript

I am currently working on integrating TypeScript and HTML to showcase the result of a webservice call as a PDF in a popup/dialog within the same page. While I can successfully open the PDF in a new tab using the window.open(url) method, I'm encounter ...

Efficiently shrink column width in Material-UI's <TableRow/> using ReactJS and Material-UI

At the moment, I am utilizing ReactJS along with Material-UI. One issue I am encountering is that when using Material-UI's <Table>, the columns' width are automatically set based on content which results in all columns having equal width. H ...

Tips for navigating through a div with an unknown height

I am currently working on developing a sleek messaging system and I have encountered an issue with the interface design. My project is built using Materialize, however, I am open to tweaking it with custom CSS if necessary. The layout consists of a list of ...

Set the page to be rigid instead of flexible

I'm struggling to lock this webpage in place, so it doesn't resize when the browser window changes. The text keeps collapsing whenever I adjust the size of the browser, and I can't figure out what's going wrong. Can someone please help ...

Tips for stopping html form from refreshing upon submission

Hello, despite extensive searching and testing, I am still unable to locate the issue and therefore I am reaching out to seek your assistance in resolving my problem. Within a form that I have created, upon clicking the submit button, a javascript functio ...

Attention: A notice from NPM - TSLint is no longer supported due to the preference of ESLint, despite ESLint

My package.json clearly shows that I am using ESLint instead of TSLint: { "name": "_gui", "version": "1.0.0", "description": "GUI", "main": "index.js", "browser& ...

Deselect a selected radio button by clicking on it

I am trying to create a radio button with an unchecked value, and I thought this code would work: $('form').on('click', 'input[type="radio"]:checked', function (event) { $(this).prop("checked", false); }); It seems simpl ...

Bootstrap grid for thumbnails

I am attempting to create a responsive grid with thumbnails using Bootstrap and Knockout. Here is the current HTML code: <div class="row"> <!-- ko if: toys().length == 0 --> <div>No toys in category</div> <!-- /ko -- ...

Combining Two Objects in Laravel and Vue.js: A Step-by-Step Guide

Currently, I am in the process of developing a basic CRUD App using Laravel along with Vue.JS (including Vuex). However, I have encountered a small issue. The problem lies within the 'categories' table, the structure of which is visible in the pr ...

Show XML data with namespaces - utilizing PHP

Can someone help me figure out how to display values from an API that returns XML? I've been searching, but most examples don't have namespaces or handle both. When I try with both, it always causes bugs and fails to display the values... Here i ...