[英]How to put CSS style inside a php code?
我想編輯表格的輸入框,即用戶在表格中輸入用戶名和密碼的字段。 我在 php 代碼中創建了這個表。
現在我想用不同的顏色制作輸入字段文本,並且只能用小寫字母而不是大寫字母。
我嘗試為所選的 td 提供課程,例如class="smallCaps"
並嘗試在外部 css 文件中進行編輯,但沒有奏效。
<?php
if ($username && $userid){
echo "You have logged in as <b> $username </b>. Click here to <a href='logout.php'> Logout </a>";
}
else {
$form = "<form action= 'index.php' method='POST'>
<table>
<tr> <td> <font color='black' face='arial' size='3'>Username: </font> </font></td> <td> <input type='text' name='user' placeholder='Username' > </td>
<td> <font color='black' face='arial' size='3'>Password: </td> </font><td> <input type='password' name='password' placeholder='Password'></td>
<td> <button type='submit' class='btn' name='loginbtn' value ='Login'><font size='3'>Login</font> </td></button>
<tr><td> <a href='signup.php'> <font color='black' face='arial' size='3'>Register</font> </a> </td> </tr>
</table>
</form>";
我不確定你在這里做什么。 您是否包含外部 css 文件?
我假設你做了 [ class='smallCaps' ] 而不是 [ class="smallCaps" ] 這會與 echo 沖突。
你應該嘗試這樣的內聯樣式:
<table style=" background-repeat:no-repeat; width:450px;margin:0;" cellpadding="0" cellspacing="0" border="0">
<tr style="height:40px; width:450px; margin:0;">
<td style="height:40px; width:40px; margin:0;">
等等....
嘗試分別保留客戶端和服務器端代碼。 您可以通過執行以下操作來做到這一點:
echo '<table class="myClass">';
然后將表格樣式放在您聲明的類中
.myClass{
top: 15px;
left: 10px;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.