Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3617592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:38:40+00:00 2026-05-18T22:38:40+00:00

I am creating a contact form that will be included on several different sites.

  • 0

I am creating a contact form that will be included on several different sites.

The styles of the contact form and the styles of the site will both be included and I can’t very well predict the styles of the site. I want the styles of the contact form to be easily over-ruled by the styles of the site, but I don’t want to styles of the contact form to be accidentally over-ruled.

For example, if the site developer wants to change the color of the submit button, it should be easily done without using !important or some excessively specific #id #id element .class #id element.class type of selector.

But, on the other hand, if the site developer wrote styles using selectors like input { background: yellow; } or #site-wrapper input { background: yellow; } I don’t want it to over-rule my contact form styles that refer to classes, .contact_input { background: white; }

So my question is, what would the best practices be in this situation? I was thinking of putting an ID on my form and adding that to every selector, so my selectors would become #contactform .contact_input { background: white; } and I think that would work in terms of avoiding conflicts, but I’m wondering if there is a better way to do it, because that seems a little ineffecient in terms of page rendering. Maybe it’s not a big deal, but I just thought I’d throw it out there and see what people think.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:38:41+00:00Added an answer on May 18, 2026 at 10:38 pm

    That’s a quite hard cause both, the selector itself and its location in sheet do matter. Also the fact that there is no only one, true way of writing CSS doesn’t help.

    I guess it would be the best if you use ID and tag selector. Additionally use attribute selector:

    #contact-form input { ... }
    #contact-form input[type=email] { ... }
    #contact-form select { ... }
    

    However you should mention that it’s strongly recommended to put that sheet on the top of others, eg:

    <link type="stylesheet" href="/styles/contact-form.css" />
    <link type="stylesheet" href="/styles/main.css" />
    

    Why that approach?

    Usually a developer will want to forms look the same all over the website, that’s why he will use tag name selector:

    input  { ... }
    select { ... }
    

    These selectors are weaker that #contact-form input so they won’t override anything. However sometimes it’s necessary to override some rules so the developer will use #contact-form input selector which is pretty natural in such case.

    If sheets has been attached as a recommendation says developer’s styles will override yours, despite the fact that both have selectors with exactly same strength. That’s why the location of the rules matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an HTML contact form that uses a standard image for a
I am creating a widget that you can assign a contact to onClick. I
I have a very simple contact form on my site, Im looking for users
I'm creating a web page that user can send pm , receive it,add contact,response
I'm creating a contact form for my company and I want to make it
I'm creating a simple contact form within my ZF application. It doesn't feel like
I'm creating a Django powered website that will have numerous applications (Blog, Shop, Portfolio,
Picture this: you are creating a little module that people can incorporate into their
I'm currently working on creating electronic version of various request forms. Each form will
I am creating a logging object that will take all logs sent to it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.