2012-03-27 8 views
0

Ich bin mir nicht sicher warum, aber das Bild zeigt tatsächlich, aber es hat ein [x] darüber, als ob es ein gebrochener Link ist? Die Seite kann eingesehen werden unter: www.klassaktkreations.comWarum ist mein Sprite-Bild kaputt [x], aber es wird auch das Bild angezeigt?

index.php

<!DOCTYPE HTML> 
<html> 
<link rel="stylesheet" type="text/css" 
media="screen" href="style.css"> 

<?php 
    $name = $_POST['name']; 
    $email = $_POST['email']; 
    $message = $_POST['message']; 
    $from = 'From: My Website'; 
    $to = '[email protected]'; 
    $subject = 'Website Inquiry'; 

    $body = "From: $name\n E-Mail: $email\n Message:\n $message"; 

if ($_POST['submit']) { 
    if ($name != '' && $email != '' && $message != '') { 
      if (mail ($to, $subject, $body, $from)) { 
      echo '<p>Your message has been sent!</p>'; 
     } else { 
      echo '<p>Something went wrong, go back and try again!</p>'; 
     } 
    } else { 
     echo '<p>You need to fill in all required fields!!</p>'; 
    } 
} 
?> 

<head bgcolor="Black"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>My Website Title</title> 
</head> 

<body bgcolor="Black"> 

    <header class="body">       
<center><img class="home" src="sprite2.png" width="1" height="1"/></center> 
    </header> 

    <section class="body"> 
<form method="post" action=""> 

    <label><strong>Name</strong></label> 
    <input type="text" name="name" placeholder="Type Here"> 

    <label><strong>Email</strong></label> 
    <input name="email" type="email" placeholder="Type Here"> 

    <label><strong>Message</strong></label> 
    <textarea name="message" placeholder="Type Here"></textarea> 
    <input id="submit" name="submit" type="submit" value="Submit"> 

</form> 
    </section> 

    <footer class="body"> 
    </footer> 

</body> 

</html> 

style.css - Sie werden feststellen, i mit nur 3 Bilder für ein ein Sprite bin mit Submit-Button und ein Titelbild .

body {color:white;} 

label { 
    display:block; 
    margin-top:20px; 
    letter-spacing:2px; 
} 

img.home 
{ 
width:230px; 
height:119px; 
background:url(http://www.klassaktkreations.com/images/sprite2.png) 0px 0px; 

} 

/* Centre the page */ 
.body { 
    display:block; 
    margin:0 auto; 
    width:576px; 
    background-color:black; 
} 

/* Centre the form within the page */ 
form { 
    margin:0 auto; 
    width:459px; 
} 

/* Style the text boxes */ 
input, textarea { 
    border:1px solid #97d6eb; 
    width:439px; 
    height:27px; 
    background:#444243; 
    border:1px solid #dedede; 
    padding:10px; 
    margin-top:3px; 
    font-size:0.9em; 
    /*color:#3a3a3a;*/ 
    color:#ffffff; 
    border-radius:5px; 
    -moz-border-radius:5px; 
    -webkit-border-radius:5px; 
} 

textarea { 
    height:213px; 
} 

#submit { 
    width:146px; 
    height:50px; 
    background-image: url(http://www.klassaktkreations.com/images/sprite2.png); 
    background-position: 0px -129px; 
    text-indent:-9999px; 
    border:none; 
    margin-top:20px; 
    cursor:pointer; 
} 
    #submit:hover { 
    background-image: url(http://www.klassaktkreations.com/images/sprite2.png); 
    background-position: 0px -189px; 
    } 
+1

'

' Tags? Was ist das 1993? :-P –

+0

Tatsächlich haben Sie dieses HTML5 beschriftet, und das

-Tag wurde aus dieser Spezifikation entfernt. –

+0

Mutter Gottes ... – Mathletics

Antwort

2

Sie Ihre img-Tag ein Hintergrundbild zu geben.

Die src des Image-Tags wird nicht geladen (daher die [x]), und der Hintergrund wird geladen (daher das Bild).

+0

ok ich änderte es in nur:

aber es hat immer noch eine Grenze um es, die ich nicht angegeben habe. – AndroidNewb

+0

@AndroidNewb: Versuchen Sie nicht, ein "img" -Tag zu verwenden. Versuchen Sie stattdessen ein "div". –

+0

hat es funktioniert !!! danke, ich habe das div-tag verwendet, anstatt das image-tag zu verwenden. Noch eine Frage, es scheint, dass einige andere Entwickler sich über mich lustig machen, indem sie das

Tag benutzen, ich habe kein HTML5 Äquivalent dazu gesehen, wie wird es jetzt gemacht? – AndroidNewb

0

Sie haben einen fehlerhaften Link hier:

<center><img class="home" src="sprite2.png" width="1" height="1"/></center> 
+0

ok ich habe es auf nur geändert:

aber es hat immer noch eine Grenze darum, die ich nicht angegeben habe. – AndroidNewb

+1

Rand hinzufügen: 0; to .home – kamalo

+0

versuchte dies, aber es scheint, dass Rocket hatte Recht, mit einem div-Tag anstelle von einem IMG-Tag gearbeitet !!! – AndroidNewb

Verwandte Themen