Share Your Work

ItsDave
Participant

Targeting text within a form using CSS?

SOLVE

Hi, there. So I am trying to do something pretty basic.

I want to make the text for one of the fields in my Hubspot form a different color. I assumed this would be pretty easy--I would just open the page in Inspect and find the ID generated for that DIV and target the text that way. Then use a simple CSS line in the attached CSS file for this page.

Apparently it's not as easy as that. The text is inside a <span> which is inside a <label> which is inside a <div>.

Shouldn't I be able to simply grab the ID for the label and simply say

#abc123 {
color: #888888;
}

?

0 Upvotes
1 Accepted solution
mangelet
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Targeting text within a form using CSS?

SOLVE

@ItsDave 

 

Consider looking at css specificity...

 

You probably want to start with something like

 

.hs_cos_wrapper_type_form .hs-form-field > label { color: #888888}

Martin Angeletti
HubSpot Veteran (12+ years)

Worried about messing up your HubSpot? I've got your back.

Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).

️ Don't get left behind.

→ Click the subscribe button and scroll down to find the opt-in box.

Subscribe

Did I help answer your question? Mark this as a solution.

View solution in original post

0 Upvotes
1 Reply 1
mangelet
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Targeting text within a form using CSS?

SOLVE

@ItsDave 

 

Consider looking at css specificity...

 

You probably want to start with something like

 

.hs_cos_wrapper_type_form .hs-form-field > label { color: #888888}

Martin Angeletti
HubSpot Veteran (12+ years)

Worried about messing up your HubSpot? I've got your back.

Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).

️ Don't get left behind.

→ Click the subscribe button and scroll down to find the opt-in box.

Subscribe

Did I help answer your question? Mark this as a solution.

0 Upvotes