WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Remove the default "size=40" attribute? (10 posts)

  1. AsraiLight
    Member
    Posted 1 year ago #

    I need to set different widths for my input boxes for IE versus other browsers, the most accurate of which is supposedly to do the pixel width in CSS. Unfortunately, the "size=" attribute in the text form fields is added by default, whether I specify the size or not, and that appears to override my CSS...so any styles I use that are conditional on browsers won't work.

    Is there a way to keep CF7 from automatically adding size=40 if I don't want any size to be applied at all, and instead control that through stylesheets?

    http://wordpress.org/extend/plugins/contact-form-7/

  2. steve1980
    Member
    Posted 1 year ago #

    Same problem for me.

  3. secretblogger
    Member
    Posted 1 year ago #

    Same for me - with one difference - How do I change the size of the forms as such? :)

  4. biswajeet
    Member
    Posted 1 year ago #

    Just target your style with appropriate tag, it will work regards of default size...

  5. AsraiLight
    Member
    Posted 1 year ago #

    Thanks biswajeet, that was actually the first thing I tried...but it doesn't work. The "size" attribute within the actual tag always overrides any CSS I put in the stylesheet. I just wish there was a way to keep Contact Form 7 from adding the "size" attribute at all, instead of always adding it regardless of whether it's defined in the contact form.

  6. biswajeet
    Member
    Posted 1 year ago #

    Here you go div.wpcf7 input { width: 25%; }
    Just put this line on your theme css or alternately you can modify CF7 css as per your choice.

    In case if your theme has any conflict, well in that case you need to investigate the issue...

    If this doesn't work, then let me know the url of your form.

  7. AsraiLight
    Member
    Posted 1 year ago #

    Thank you, I will try that on Monday and see if it fixes the issue. I will still need to define two different ones, depending on if it's IE or not. But hopefully this will at least fix this particular issue!

  8. AsraiLight
    Member
    Posted 1 year ago #

    I tried the technique above, but now it's caused another issue. Any field for which I have defined the size is now overridden by this percentage, and appears at 80% of the maximum possible width, even if I've tried to set it to a smaller size.

    Using max-width instead of width offers closer results, but still not accurate. I am playing with it to see if I can get it how I need it, but any other suggestions would be very welcome.

  9. biswajeet
    Member
    Posted 1 year ago #

    Its time consuming to provide resolution in this way...
    If you need accurate result, provide your form url and your style requirement details. Will write the necessary css for you.

  10. AsraiLight
    Member
    Posted 1 year ago #

    That would be very generous of you, thank you. Unfortunately our form is currently on a development server, not visible to the public. I will see if I can get a public version and send it to you, to see if you have any ideas.

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic