Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: css and forms

  1. #1
    Regular Coder nexosis's Avatar
    Join Date
    Dec 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    css and forms

    How do I add a background-color in forms?
    How do I add a background-picture in forms, too?

    progress: HTML: 100% > CSS: 90% > Javascript: 55% > Php:10%
    Want an avatar like mine? it's free! just pm me.

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    You put a div in between the form tags and apply colors/images to the div.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder nexosis's Avatar
    Join Date
    Dec 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could we just make it
    Code:
    <style type="text/css">
    input.1{background: myimage.jpg}
    .2{background-color: #cfcccc}
    </style>

    progress: HTML: 100% > CSS: 90% > Javascript: 55% > Php:10%
    Want an avatar like mine? it's free! just pm me.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The syntax you are using is a little incorrect. First off ids or classes can't start with a number or special character. So using .1 and .2 is already incorrect. Second your background declaration contains no url(). Correct syntax would be
    Code:
    <style type="text/css">
    input.one{background: url(myimage.jpg)}
    .two{background-color: #cfcccc}
    </style>
    Code:
    <form class="two">
    <input class="one" type="text">
    </form>
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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