CMS Development

petras
投稿者

Edit the color of the error messages of a form

解決

Hello, I hope somebody can give me some advice. Can anybody tell me how I can edit the color of the error message of a form. Now hardly it can be detinguished from the general text. Can I do this by editing the CSS of the form only? Thanks so much. Best regards, Petra

1件の承認済みベストアンサー
petras
解決策
投稿者

Edit the color of the error messages of a form

解決

Thanks so much for your response. All the commands work except the color. I don´t know if I have some superior stylesheet which limits this. The code I have included in the CSS sheet. Thank you a lot and best regards,
Petraform2.PNGcode.PNG

元の投稿で解決策を見る

0 いいね!
14件の返信
Lasse-Eggen
参加者

Edit the color of the error messages of a form

解決

When we embed a form into another website, the default HubSpot color for errors is a red-ish color, #f2545b.

 

This color on a white/light background is not conforming to the WCAG color-contrast guidelines.

Our customers' and our own view, and hopefully your view, is that it's in HubSpot's interest to conform to WCAG guidelines for the most likely background color.

 

It's the following global CSS that sets the color (as mentioned previously in this thread).

 

.hs-error-msgs label {
    color: #f2545b;
}

 

We are not interested in using HTML forms for embedding, just normal HubSpot forms from the form builder.

0 いいね!
deeanna
参加者

Edit the color of the error messages of a form

解決

I also have this problem but maybe in a different situation. I use the HubSpot forms not with the HS CMS but with WordPress. My forms sit on a dark orange WordPress theme and no one can see the error messages because they are red. I am on Marketing Hub Starter and my understanding is that changing the stylesheet works only from Professional+

The theme is, of course, complicated and I have no idea how to change the style of the theme. I need a solution for styling the form itself so error message text is black.

0 いいね!
pr_designteam
メンバー

Edit the color of the error messages of a form

解決

I'm having this issue as well and none of the above solutions work. I really want to avoid custom coding a form because the rest of my team cannot code.

0 いいね!
Sellmx
メンバー

Edit the color of the error messages of a form

解決

Hi Petras,

 

Unless the theme has some custom classes overriding the error messages, it should be pretty easy to customize the color of the texts.

 

All you have to do is add some custom styles to the page header. Something like this should do the trick –

 

<style>
  .hs-form-field .hs-error-msgs { color: red; }
</style>

Here's a quick GIF of how to do that.

 

c8rMkc.gif

 

Hope this helps. If you have any more troubles fixing the styles, feel free to reach out to me at hi@sellmx.com and I can help you out, no charge!

0 いいね!
cyberlobe
メンバー

Edit the color of the error messages of a form

解決

Hello Friends, 

 

I tried above code and it's not working for me, can anyone help pls?

 

https://wardpeter.com/SD_New/contact-us

0 いいね!
TRooInbound
キーアドバイザー

Edit the color of the error messages of a form

解決

Hi @cyberlobe 

I show on your page,

try this code

.hs-error-msgs label {
    color: #f2545b !important;
}
MLiu8
参加者

Edit the color of the error messages of a form

解決

i was looking for this answer for soo long. Thank you!!!

cyberlobe
メンバー

Edit the color of the error messages of a form

解決

I tried that its not working

0 いいね!
TRooInbound
キーアドバイザー

Edit the color of the error messages of a form

解決

Hi @petras

 

need to just add below CSS to some error list target class like,

ul.hs-error-msgs > li > label {
    font-size:12px;
    line-height:normal;
    display:block;
    color:red;
}

add this CSS Syntax in your CSS stylesheet.

 

Did my post help answer your query? Help the Community by marking it as a solution.

 

Team TRooInbound

0 いいね!
petras
解決策
投稿者

Edit the color of the error messages of a form

解決

Thanks so much for your response. All the commands work except the color. I don´t know if I have some superior stylesheet which limits this. The code I have included in the CSS sheet. Thank you a lot and best regards,
Petraform2.PNGcode.PNG

0 いいね!
TRooInbound
キーアドバイザー

Edit the color of the error messages of a form

解決
ul.hs-error-msgs > li > label {
font-size:12px;
line-height:normal;
display:block;
color:red !important;
}

@petras
Replace code with above code

Did my post help answer your query? Help the Community by marking it as a solution.

Team TRooInbound

petras
投稿者

Edit the color of the error messages of a form

解決

Thanks so much, your post did just exactly what it should do. Everything fine now. Have a nice day ahead. Petra

0 いいね!
TRooInbound
キーアドバイザー

Edit the color of the error messages of a form

解決

Hey @petras,

 

That's Cool! Cheers! 

 

Did my post help answer your query? Help the Community by marking it as a solution

 

Team TRooInbound

 

0 いいね!
Sellmx
メンバー

Edit the color of the error messages of a form

解決

You can try adding an "!important" tag to the property in case something is overriding it.

 

color: red !important;
0 いいね!