Replace the default MailChimp stylesheet with a different stylesheet

Objective: I want to modify the background color of the "Subscribe" button on a MailChimp embedded sign-up form found on our company's website page.

Query: MailChimp provides the CSS hook "input.button" for styling the Subscribe button. How can I utilize this CSS to overwrite the existing styles?

The specific page that needs editing is located here:

This is how the button is coded within the HTML of the page:

<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>

Unfortunately, I don't seem to have access to the stylesheet used by MailChimp to generate the embed code (). Here are the styles defined in the MailChimp stylesheet:

#mc_embed_signup .button {clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding: 0 22px; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;}

I appreciate any assistance provided. Thank you!

Answer №1

Unfortunately, due to my lack of experience, I am unable to provide a simple comment at this time. However, have you considered the option of duplicating the content in their stylesheet () and creating a new stylesheet for your own use? By referencing your new stylesheet instead of the old one on your subscription page, you can customize any design elements without affecting those that you prefer.

Answer №2

I integrated this solution into my website a year ago with the intention of creating a tutorial, but I believe sharing it on SO will benefit more people. I have put together a demo showcasing the HTML and CSS code required to style the opt-in Mailchimp form.

The styling for the input.button can be customized extensively. Below is the snippet to modify the entire button appearance, although you may choose to alter just the background-color. For a comprehensive guide on form styling, please refer to the linked demo as it includes additional details.

input.button {
    -moz-box-shadow: inset 0 1px 0 0 #bbdaf7;
    -webkit-box-shadow: inset 0 1px 0 0 #bbdaf7;
    box-shadow: inset 0 1px 0 0 #bbdaf7;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5);
    background:-moz-linear-gradient(center top, #79bbff 5%, #378de5 100%);
    filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#378de5');
    background-color: #79bbff;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    border: 1px solid #84bbf3;
    display: inline-block;
    color:#fff;
    font-family: arial;
    font-size: 16px;
    font-weight: 700;
    padding: 7px 32px;
    text-decoration: none;
    text-shadow: 1px 1px 0 #528ecc;
}

You may consider updating the :hover state with the following CSS rules.

input[class=button]:hover {
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff));
    background: -moz-linear-gradient(center top, #378de5 5%, #79bbff 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff');
    background-color: #378de5
} 

The HTML structure.

<div class="bu1">
     <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
 </div>

The expected output after applying these styles.

An alternative approach (not tested) would involve adding this in your custom stylesheet or appropriate location:

#mc_embed_signup .button { background-color: lightcoral; }
 

The result, validated using Chrome Developer Tools, is displayed below.

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

Is it possible to include an onclick event in a hyperlink tag to initiate an ajax call

I am looking to incorporate an ajax call within a hyperlink tag "a". The purpose of this ajax call is to send some information to the server without expecting any return value. I attempted the following approach: document.querySelector("#myId").onclic ...

Text overflow occurs when content overflows the space of its container, causing the HTML element to

My English isn't the greatest, but I hope to convey the question clearly. I am attempting to create an editable text within a div. Typically, the text will overflow the size of the div, so I need to contain the text in the div using overflow:scroll. ...

Concealing the sidebar navigation menu on the web application

I have developed a custom Angular 4 web application. My goal is to implement an automatic hide feature for the navbar when a user hovers over it. I came across an example that demonstrates what I want to achieve at https://codepen.io/JFarrow/pen/fFrpg. Des ...

Save information to a server-side .xml file with the use of either JavaScript or PHP

I have a website built using HTML and JavaScript. Currently, I am successfully retrieving data from a server-side .xml file on the site. Everything is working perfectly! However, I am facing issues with allowing users to input data into a field and save ...

Looking for assistance with CSS border animation

Below is my code snippet: .section-one { position: relative; background: #ffffff; } .section-one h2 { color: #000000; font-size: 32px; margin: 0px 0px 10px 0px; padding: 0px; font-family: "AzoSans-Medium"; } ... /* ...

Unable to query MySQL database for filtering by month using PHP

As part of my Student work at the local college, I was tasked with creating a website on a specific topic. I chose Parking Car Lot as my topic, but now I'm stuck and not sure where to find the issue. My main goal is to filter data by year and month fr ...

Revamp the Bootstrap Form Upload feature

I am looking to redesign the Bootstrap Form Upload field. The main reason behind this is that in Bootstrap, the file upload field is treated as one single component, making it impossible to separate the file upload button from the file upload text. The fi ...

Display a petite popup above the selected text within the Code Mirror editor

I have been utilizing the following code snippet to highlight text segments in Codemirror, a renowned code editor and syntax highlighter that can be downloaded from this link. Despite referring to the documentation, I am still unable to grasp how this fun ...

The CSS transition fails to function correctly once a specific function is executed

When I hover over a div, the background color changes due to a transition effect. However, if I click on a button that triggers myFunction2 to change the background color of the div before hovering over it, the transition effect no longer works. functi ...

Directing BeautifulSoup to a specific <tr> class

I'm currently working on a project where I need BeautifulSoup to extract the numbers located in the "Units Sold" column: from bs4 import BeautifulSoup from urllib import urlopen html = urlopen('http://www.the-numbers.com/home-market/dvd-sales/2 ...

Tips for removing a particular slide from bootstrap carousel with JQuery

I'm a beginner when it comes to bootstrap. I have a Carousel with some slides that include a Decline button. When the button is clicked, I want to delete/remove that slide and move on to the next one. Can this be achieved using JQuery? I've been ...

Stop the window from scrolling up smoothly when opening a custom modal to avoid any flickering

I encountered a problem with a custom modal window that would open on click and move to the top of the viewport. The issue was that when scrolling up, the page beneath would be visible, so I needed to restrict scrolling once the modal was open. Below is th ...

Using jQuery to select and animate several elements simultaneously without repeating the animation

Issue Summary (Fiddle): I'm trying to make all elements fade out simultaneously when clicked, but the current code causes the target to trigger three times resulting in three alert() calls. I want them to fade together without using a wrapper element ...

Media publications do not conform to the current trends

I'm currently utilizing the HTML-to-paper plugin to print my content on a printer. However, I've encountered an issue where it doesn't seem to apply any of the styles I've defined within @media print. The challenges I'm encounteri ...

Moving object sideways in 100px intervals

I'm struggling to solve this issue. Currently, I have multiple div elements (each containing some content) that I need to drag and drop horizontally. However, I specifically want them to move in increments of 100px (meaning the left position should b ...

"PHP: Are you sure you want to delete? Confirm your

I'm trying to add a delete account button on my website, but I'm struggling with the implementation. Here's what I have so far: Javascript: <script language = "JavaScript" > function deleteUser(id) { if (confirm ...

Assigning a changing label to a radio button

Looking to create a dynamic form where clicking a button calls a JavaScript function. Here's the code snippet: function addRadioButton(type){ var element = document.createElement("input"); //Set attributes for the element. element.setAttr ...

Output each uploaded file using jQuery's console.log function

My AJAX upload form is set up and working, but when multiple files are selected they all upload at once. I want to create a separate div for each file to show the progress individually. However, when I try to test the number of files using this code snippe ...

What could be causing my table to malfunction in IE8?

Is it just me, or do my CSS tables not work on IE8? <div class="main-table"> <div class="row"> <a class="secondary-table" href="#"> <div class="secondary-row"> <div class="secondary-cell"> ...

A guide to creating gradient borders using CSS

Does anyone have advice on applying a gradient to a border in CSS? I attempted using the following code: border-color: -moz-linear-gradient(top, #555555, #111111); Unfortunately, it did not work as expected. Can someone share the correct method for creat ...