เอา css มาคลุม code php ทำไงครับ

เริ่มโดย atmake, 05 มีนาคม 2009, 14:05:41

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

atmake

ผมมี .css อยู่แล้ว

อยากจะเอามาคลุม code php อ่ะครับ

ต้องทำยังไงบ้างครับ

เพราะผมลอง span แล้วก็ไม่ได้  คลุม table ใส่ class ก็ไม่ได้ครับ


ขอบคุณครับ

hermiss

<style type="text/css" media="all"> @import url(ชื่อไฟล์.css);</style>

ลองเอาแทกนี้ไปใส่ใน <head> ก่อน</head> นะ เปลี่ยน ชื่อไฟล์  เป็นชื่อของนายนะ น่าจะได้นะ

ที่จริงมันใส่ได้หลายแบบ แต่แบบนี้เราไปลอกมาจากเวบ longdo.com  อะ

atmake

ยังไม่ได้อยู่ดีอ่ะครับ  ???

hermiss

งั้นลองแบบธรรมดาละกัน  :'( ใส่ไว้ระหว่าง <head> กับ </head> นะ

<link rel="stylesheet" type="text/css" href="เปลี่ยนชื่อไฟล์ตรงนี้นะ.css">

g-ji

#4
มันต้องดูโค้ดด้วยนะว่า

เรียก id กับ class ถูกมั้ย

ลอง copy code นี้ไปนะ


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
   <title>test css</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <style>
<!--
   body{
   width:980;
   margin:0% auto;
   background-color:#eee;
}
   #wrap table{
   width:98%;
   margin:1% auto;
}
    #wrap table th {
    color:#fff;
    width:50%;
}
   #wrap table tr{
   width:98%;
   background-color:blue;
}
   #wrap table td {
   font-family:Tahoma;
   font-size:30px;
   color:red;
   text-align:center;
}
   #wrap table th,td{
   border:0px solid #000;
}
   #wrap table th:first-child{
   color:orange;
}
   #wrap table tr td:first-child{
   color:#000;
}
-->
</style>
</head>
<body>
<div id="wrap">
<table>
   <th>col1</th>
   <th>col2</th>
      <tr>
         <td>Test</td>
         <td>your php</td>
      </tr>
</table>
</div>
</body>
</html>


วางใน note pad ก็ได้ แล้ว เซฟเป็น html แล้วเบิ้ลคลิกเปิดดูนะ

เปิดด้วย fire fox จะดีมาก จะเห็นการกำหนดค่าสี ในตาราง โดยที่ไม่ต้องเรียก คลาส หรือ id (โค้ดนี้มี id เดียวคือ id="wrap")

ลองเอาไปปรับใช้กับ โึค้ดของตัวเองดูละกัน

ปล. IE 6 ไม่รู้จัก :first-child - -* ie 7 มันรู้จักมั้ยหว่า

atmake

ขอบคุณทุกท่านครับ

เด๋วผมจะลองดูครับ  :-[

hermiss

น่าจะเห็น ลองรันใน ie7 กับ ff ให้ผลเหมือนกัน

ป.ล. เห็นว่า ie ลอกหลายอย่างจาก ff นะ

mama2008

ขอดูหน้า ที่ใช้ css ไม่ได้ หน่อยคับ
เผื่อมีอะไรช่วยได้บ้างคับ
:)

Rungson

ทำไมไม่ลองสร้าง css เอาไว้อยู่ใน page code เดียวกันเลยละครับ จะได้จัดการอะไรง่าย