SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Input - Submit

  1. #1
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Input - Submit

    Hi,

    How can I use a CSS class for all submit buttons? Like
    Code:
    input
    {
        /* is used for all form elements */
    }
    
    input:submit
    {
        /* something like this but is actually real CSS :P */
    }
    Thanks

  2. #2
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, you'll need to look into attribute selectors for CSS.

    http://www.google.com/search?q=css+attribute+selector

  3. #3
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something like this...
    Code:
    input
    {
        /* is used for all form elements */
    }
    
    input.whatever
    {
        /* something like this but is actually real CSS :P */
    }
    
    ---------------------
    
    <input type="submit" name="submit" id="submit" class="whatever" />
    should do the job. not sure if there's any other way (avoiding a class assignment in your (x)html )...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  4. #4
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    redux, using attribute selectors for this is a neater way.

    Of course the disadvantage would be spotty browser support.

  5. #5
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heh...i'm still learning basic CSS, so i have to plead ignorance on the technique of attribute selection...but now that i've looked at it, all i can say it...wow.

    so, something like this then ?

    Code:
    input
    {
        /* is used for all form elements */
    }
    
    input[type="submit"]
    {
        /* something like this but is actually real CSS :P */
    }
    
    ---------------------
    
    <input type="submit" name="submit" id="submit" />
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by redux

    so, something like this then ?

    Code:
    input
    {
        /* is used for all form elements */
    }
    
    input[type="submit"]
    {
        /* something like this but is actually real CSS :P */
    }
    
    ---------------------
    
    <input type="submit" name="submit" id="submit" />
    You're almost there redux! input[type="submit"] is actually a CSS2 attribute selector and does work, but not in all browsers. It does work in Mozilla and I believe it works in Opera 7, but IE is still the big holdout in CSS2 support here. Personally, I use the CSS2 unless a client requests otherwise. I figure once they upgrade (or if IE7 supports CSS2 more) they'll get a nice treat on their site when they log in.


Bookmarks

Posting Permissions

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