Results 1 to 6 of 6

Thread: Getting Inputs and Buttons To Appear the same in All Browsers

  1. #1
    Join Date
    Dec 2010

    Getting Inputs and Buttons To Appear the same in All Browsers

    Can anyone provide any tips on how to get text inputs, submit buttons etc to appear the same in all browsers?

    I have recently been provided the suggestion to put absolutely every input element inside it's own div. Is this a valid solution and are the any better ones?

    I'm just looking for ideas really

  2. #2
    Join Date
    Sep 2008
    Akron, OH
    The only true guarantee is to convert them to another type of element and style that.

    Commonly, you'll see an anchor tag styled as a button, or a UL styled as a select box.
    I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!

  3. #3
    Join Date
    Dec 2010
    I understand completely. Thanks. That's what I usually do throughout my entire site to be honest.

    However what I'm trying to do this for at the moment is a login page so I really need to to use actual submit buttons and inputs as I want this page of the site to function with and without javascript, which I assume an a tag styled to look like a button would need to submit a form?

    What do you think would be some best practices to get such elements looking somewhat similar across most browsers?

    Thanks for the help so far by the way.

    The basic ones I've used at the moment are:-

    1. Use a reset to set all width and height back to 0 on all inputs and then work from there

    2. Set overflow as visible on submit buttons which enables i.e. to respect padding properly

    3. I've noticed facebook and twitter really go all out by putting every input inside a div so I'm going to try that

    Anything else you know of?

  4. #4
    Join Date
    Mar 2011
    Putting input elements in a div won't have any effect on how a browser displays the element except to force them all to appear on a separate line (unless you use CSS to do otherwise).

    Browsers do render buttons and text boxes in different ways, but they're all very much under your control with CSS. The key is to define those elements in your stylesheet to meet your needs so that the browsers don't rely on their default settings. Good luck!
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    Dec 2010
    Yep I know but how to actually do that in the css is what I struggle with at times

    As far as I can tell in my experience ie6 requires a separate style sheet as it simply differs too much in how it renders compared to more modern browsers. I'm now actually considering going down the route of producing a page which basically say's "upgrade your browser" on all my sites as I think accommodating for ie6 greatly increases development time-scale.

    ie7 however seems fixable using most basic techniques however the one I simply cannot get around is the vertical padding which ie7 adds on to submit buttons. If you know of any way of getting submit buttons in ie7 to display practically the same in all browsers without conditional statements etc and no hacks I'd be very impressed

  6. #6
    Join Date
    Mar 2011
    It turns out that input elements present a special case. But this time it's not Internet Explorer. It's Firefox and perhaps some others. The default line-height setting for the input element cannot be overridden in Firefox and perhaps other non-IE browsers. You can generally find an acceptable cross-browser compromise setting for padding, but you can run into limits if your button is not very tall/high.

    But overall, you do have a great deal of control over buttons with CSS. Since you say you need to support IE6 (even though its down to low single-digit market share now), you'll have to add a class or id attribute to your input tag. Try the following CSS:
    .mySubmit { font-family:'times new roman',serif; font-size:12px; font-weight:bold; margin:2px 0; padding:4px; background-color:lightyellow; border:outset 1px #ccc; }
    <input type="submit" value="Submit" class="mySubmit">
    That should get you started. If you run into height issues, you can use conditional statements to add CSS settings for IE to adjust the padding to approximate the appearance of the other browsers. Good luck!
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.38808 seconds
  • Memory Usage 2,888KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates