CMS Development

Harling
Contributor

Styling Label of Radio Buttons and Form Fields

SOLVE

Hi,
to make my form look cleaner I just use the placeholder text and make the labels invisible by using this code in my css stylesheet:

 

.hs-form label {
color:transparent!important;

}

 

Now I have the problem, that my radio buttons and checkbox areas also have no label anymore (but I would need it displayed there). How can I address the labels of radio buttons to give them a different style?

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Styling Label of Radio Buttons and Form Fields

SOLVE

Seems to me that these are two indpendent techniques. When the label is a null string the space above the field collapses to reflect that as in your example.

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

0 Upvotes
4 Replies 4
Harling
Contributor

Styling Label of Radio Buttons and Form Fields

SOLVE

It still would be interesting to have a possibility to style drop box labels different by CSS, but for now the solution to delete the labels is fine for me. I wonder what happens for disabled people with screen reader, if the fields have no label anymore. THis is the reaso why I just set them transparent in the first step.

0 Upvotes
SteveHTM
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Styling Label of Radio Buttons and Form Fields

SOLVE

@Harling - I have found that the easiest way to selectively remove labels is just to clear the label string on the form definition when you set up the placeholder. This way you can have a mix of styles dependent on the field type & other requirements.

 

Hope this helps!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
Harling
Contributor

Styling Label of Radio Buttons and Form Fields

SOLVE

@SteveHTM - this could be a solution, but I also make the font really small to make the form as dense as needed. This wouldn't be possible when still having the "empty labels" above the fields, but I'll try.

Harling_0-1705420904873.png

This is how my form usually should look like, no labels but only placeholder text for normal fields to fill in.

0 Upvotes
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Styling Label of Radio Buttons and Form Fields

SOLVE

Seems to me that these are two indpendent techniques. When the label is a null string the space above the field collapses to reflect that as in your example.

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes