3

my problem is the following:

This is a part of my HTML-Code:

<form method='GET' name='auftragaufgeben' action='AuftragAufgeben'>
    <input  type='submit' name='auftragaufgeben2' value='Auftrag aufgeben'>
    <input type='hidden' name='logged' value='logged'>
</form>

No i want a design for the button with the help of css. This is the code:

a.auftragaufgeben {
display: block;
background-image: url(AuftragAufgeben.png);
width: 467px;
height: 104px;
}

a.auftragaufgeben:hover {
background-image: url(AuftragAufgeben_Hover.png);
}

I found that the declaration of the class in the button tag should work, for example this:

<form method='GET' name='auftragaufgeben' action='AuftragAufgeben'>
<input  class="auftragaufgeben" type='submit' name='auftragaufgeben2' value='Auftrag aufgeben'>
    <input type='hidden' name='logged' value='logged'>
</form>

But this doesn't change anything. How can change the layout of the button to the picture i declared in the CSS part? Or is there another way to start the form when i click the picture?

Kind regards

2
  • Have you tried <button>? Commented Jun 18, 2012 at 22:34
  • No, i tried input type = "button". How do i have to do that with <button>? Commented Jun 18, 2012 at 22:38

1 Answer 1

6

in your css, the code a.auftragaufgeben and a.auftragaufgeben:hover are for styling a link element, not the button.

try

.auftragaufgeben {
    display: block;
    background-image: url(AuftragAufgeben.png);
    width: 467px;
    height: 104px;
}

.auftragaufgeben:hover {
    background-image: url(AuftragAufgeben_Hover.png);
}

UPDATE

Your final html code should look like this:

<html>
    <head>
        <style>
            .auftragaufgeben {
                display: block;
                background-image: url(AuftragAufgeben.png);
                width: 467px;
                height: 104px;
            }
            .auftragaufgeben:hover {
                background-image: url(AuftragAufgeben_Hover.png);
            }
        </style>
    </head>
    <body>
        <form method='GET' name='auftragaufgeben' action='AuftragAufgeben'>
            <input  class="auftragaufgeben" type='submit' name='auftragaufgeben2' value='Auftrag aufgeben'>
            <input type='hidden' name='logged' value='logged'>
        </form>
    </body>
</html>
Sign up to request clarification or add additional context in comments.

2 Comments

I tried this again the declaration of the class after changing the CSS to your code again. Still no change :( Edit: Another information: Im doing this in the HTML-output in a Java Servlet! Maybe there is a problem?
This is working in the HTML Code of a .html! I will try that in the servlet!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.