HTML, CSS, PHP integration for web development
This triple-tier combination demonstrates how HTML, CSS, PHP work together in modern web development.
Markup for structure
Styling and layout
Server-side scripting
Below is a complete, production-ready example showing how these technologies integrate:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML + CSS + PHP Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="app">
<h1>Welcome to HTML + CSS + PHP</h1>
<div id="content"></div>
</div>
</body>
</html>
/* Modern styling with flexbox and gradients */
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
margin: 0;
padding: 20px;
}
#app {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: rgba(255, 255, 255, 0.1);
border-radius: 16px;
backdrop-filter: blur(10px);
}
h1 {
font-size: 2.5rem;
text-align: center;
margin-bottom: 20px;
}
<?php
// Modern PHP 8+ with type hints and attributes
header('Content-Type: application/json');
class APIController {
public function getData(): array {
return [
'message' => 'Hello from PHP!',
'timestamp' => time(),
'server' => 'PHP ' . phpversion()
];
}
}
$controller = new APIController();
echo json_encode($controller->getData());
?>