How to use css style in php
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language.
more info : http://en.wikipedia.org/wiki/Cascading_Style_Sheets
CSS is not a programming language, and does not have the tools that come with a server side language like PHP. However, we can use Server-side languages to generate style sheets.
<html>
<head>
<title>...</title>
<style type="text/css">
table {
margin: 8px;
}
th {
font-family: Arial, Helvetica, sans-serif;
font-size: .7em;
background: #666;
color: #FFF;
padding: 2px 6px;
border-collapse: separate;
border: 1px solid #000;
}
td {
font-family: Arial, Helvetica, sans-serif;
font-size: .7em;
border: 1px solid #DDD;
}
</style>
</head>
<body>
<?php>
echo "<table>";
echo "<tr><th>ID</th><th>hashtag</th></tr>";
while($row = mysql_fetch_row($result))
{
echo "<tr onmouseover=\"hilite(this)\" onmouseout=\"lowlite(this)\"><td>$row[0]</td> <td>$row[1]</td></tr>\n";
}
echo "</table>";
?>
</body>
</html>
How can I style a PHP echo text?
You can style it by the following way:
echo "<p style='color:red;'>" . $ip['cityName'] . "</p>";
echo "<p style='color:red;'>" . $ip['countryName'] . "</p>";
How to use css styling in a php echo output
There is no reason to use escape character \
on single quote since you wrapped your echo
in double quotes
echo "<button class='btn'>" . $output . "</button>";
Related Topics
Sending Post Requests Without Waiting for Response
How to Submit Multiple PHP Forms While Each Form Has Its Own Submit Button
Strip Null Values of Json Object
Get Total Number of Members in Discord Using PHP
How to Increase Maximum Execution Time in Laravel
Preventing Direct Access to a PHP Page, Only Access If Redirected
How to Convert Ereg Expressions to Preg in PHP
PHP, Curl, and Http Post Example
Laravel, Sync() - How to Sync an Array and Also Pass Additional Pivot Fields
How to Do File Upload Using Jquery Serialization
How to Install Imagick/Imagemagick PHP Extension on Windows 7
Failed to Open the System Default Web Browser. Is One Installed - Pgadmin4
Laravel 5.2 Post 302 Redirect to Get
Trim Country Code from Phone Number in PHP
How to Properly Encode Utf-8 for JavaScript and Json