Selective use of background images in PHP forms

Posted on 2007-10-09
Last Modified: 2011-09-20

In my CSS I have set my forms to display a background image. However, it currently will place this image in any form I create. Is there a way to disable the background image in selected forms?

Question by:geist62
    LVL 6

    Expert Comment

    add class="something" to your form.
    then instead of having your background set to form like this
    form {
    background: url(images/tickicon.jpg) no-repeat left center;

    have it set to the class "something"

    like this

    .something {
    background: url(images/yourfilehere.jpg) no-repeat left center;

    this way when you next make a form it will just use the default settings instead of using the background image
    LVL 24

    Expert Comment

    >> disable the background image

    <form class="noimage">

       background: none;
    LVL 17

    Accepted Solution

    Simple way:

    <form style="background-image:none">

    Complex way.

    In your CSS change the part that assigns an image to your from from
    form {background-image:url(file:///images/image.jpg)} ///or what ever it is to
    form.useimage {background-image:url(file:///images/image.jpg)}
    //add the following to CSS
    form.noimage {background-image:none}

    Then in your web page change the forms that you want an image in to

    <form class="useimage">

    and the ones that you don't want an image in

    <form class="noimage">

    Author Comment


    Thanks for the help!  I'll get back soon with the solution that works for me. I am going to try the simple method as I couldn't get the complext verison to work.


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
    A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now