2013-11-15 5 views
0

CSS에서 인식 할 수있는 클래스의 id를 얻지 못하는 것 같습니다. 여기에 코드가 있습니다. 내가 간단한 것을 놓치고있는 것처럼 보이지만 그것이 무엇인지 알아 내거나 보지 못하는 것 같습니다.PHP에서 id가 작동하지 않습니다.

echo "<table class='item'> 
        <tr> 
         <td id='name'><h3>" . $name . "</h3></td> 
         <td id='itemdescription'>" . $description . "</td> 
         <td id='imagelocaiton'><img src='" . $location . "'id='image'></td> 
         <td id='price'>" . $price . "</td>"; 

와 관련된 CSS :

#image { 
width: 300px; 
height: auto; 
} 

#itemdescription { 
color: red; 
} 

감사합니다!

EDIT : 이것은 inspect 요소의 출력 HTML입니다. MySQL 데이터베이스에서 테이블 정보를 그리는 while 루프를 사용하여이 ID를 수정해야한다고 가정해야합니다. 난 그냥 ... 내 CSS는 구글 크롬하지만 사파리를 사용하여 작동하는 것 같다 것으로 나타났습니다

<html><head> 
    <title>For Sale</title> 
    <link rel="stylesheet" type="text/css" href="style.css"> 
<style type="text/css"></style></head> 
<body> 
    <div class="item_list"> 

     <table class="item"> 
        <tbody><tr> 
         <td id="name"><h3>had</h3></td> 
         <td id="itemdescription">adfafdsaf</td> 
         <td id="imagelocaiton"><img src="images/simple.gif" id="image"></td> 
         <td id="price">$0</td></tr></tbody></table><table class="item"> 
        <tbody><tr> 
         <td id="name"><h3>Idkd</h3></td> 
         <td id="itemdescription">adfaf</td> 
         <td id="imagelocaiton"><img src="images/Airplane Logo.jpg" id="image"></td> 
         <td id="price">$0</td></tr></tbody></table><table class="item"> 
        <tbody><tr> 
         <td id="name"><h3>adfag</h3></td> 
         <td id="itemdescription">adfaf</td> 
         <td id="imagelocaiton"><img src="images/Jason.jpeg" id="image"></td> 
         <td id="price">$1313</td></tr></tbody></table><table class="item"> 
        <tbody><tr> 
         <td id="name"><h3>afaf</h3></td> 
         <td id="itemdescription">adfafaf</td> 
         <td id="imagelocaiton"><img src="images/HDR1.jpg" id="image"></td> 
         <td id="price">$331</td>   

+0

나는 아이템 클래스를 놓친 것 같아 .. –

+1

에코 출력을 게시 할 수 있을까요? 아니면 우리가 볼 수있는 URL을 제공합니까? – jameslafferty

+1

@LakshmiPrasanna 제이슨이 ID를 사용하고 있기 때문에 수업에서 차이를 만들어서는 안됩니다. – jameslafferty

답변

0

코드는 사용자가 이미지 태그의 작은 변화를 만들어 가지고, 올바른 :

<td id='imagelocaiton'><img src='" . $location . "'id='image'></td> 
try make minor correction 
<td id='imagelocaiton'><img src='" . $location . "' id='image'></td> 

잘 작동하지만 $ 위치에 대한 보증이 올바른 경로와 이미지 파일명에 확장자를 가지고 있습니다. 나는 주어진 CSS에 따라 붉은 색과 이미지의 설명을 얻었다.

관련 문제