I’d really appreciate help with assigning colour, possibly with code, to a back button I used that was featured in another community post. I’m using Dawn theme and here’s the code I used to assign the button:
And I’m super happy with the buttons location at the bottom of the product listing, and that it goes back to last page/collections…I Just can’t seem to work out the colouring and would love it to match the rest of my website.
Would anyone have an idea how to adapt or create code for this? Let me know if you’d like any extra info etc.
Hi @Shex , To style your back button in the Dawn theme and match it with the rest of your website, you need to add CSS rules to your theme’s stylesheet or use the theme’s custom CSS editor (usually found in the “Theme settings” under “Custom CSS”). Here’s how you can modify your code to include coloring and other styling:
add this css to your theme.liquid file before tag or in your theme css file:
.back-button {
text-align: center;
display: block;
margin: 20px 0; /* Adjusts spacing if needed */
}
.back-button a {
display: inline-block;
padding: 10px 20px; /* Adjusts button size */
color: #ffffff; /* Text color */
background-color: #007BFF; /* Button background color */
border: 2px solid #0056b3; /* Button border color */
border-radius: 5px; /* Rounds the button edges */
text-decoration: none; /* Removes underline */
font-size: 16px; /* Adjusts font size */
font-weight: bold; /* Makes text bold */
transition: background-color 0.3s, color 0.3s; /* Smooth hover effect */
}
.back-button a:hover {
background-color: #0056b3; /* Darker shade on hover */
color: #ffffff; /* Maintains text color on hover */
border-color: #003d80; /* Adjusts border on hover */
}