L1 Communication et Médias - Technologies Web
2 heures
Vous allez créer une page web de présentation personnelle comprenant :
Dans une architecture web :
Installation :
Utilisation :
mon-site/
├── index.html
├── style.css
├── images/
│ ├── photo.jpg
│ └── projets/
│ ├── projet1.jpg
│ ├── projet2.jpg
│ └── projet3.jpg
└── js/
└── script.js
Avec Live Server :
http://localhost/mon-site/index.html
│ │ │ └── Fichier demandé
│ │ └── Dossier du projet
│ └── Nom d'hôte local
└── Protocole
<!DOCTYPE html>
<html>
<head>
<title>Test Serveur</title>
</head>
<body>
<h1>Mon serveur fonctionne !</h1>
<p>Date et heure : <span id="datetime"></span></p>
<script>
document.getElementById('datetime').textContent = new Date().toLocaleString();
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mon Portfolio</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Le contenu viendra ici -->
</body>
</html>
<header>
<h1>Prénom NOM</h1>
<p>Étudiant(e) en L1 Communication et Médias </p>
</header>
<section class="about">
<h2>À propos</h2>
<img src="photo.jpg" alt="Ma photo" class="profile-photo">
<p>Présentez-vous en quelques lignes...</p>
</section>
<section class="projects">
<h2>Mes Projets</h2>
<div class="project-grid">
<article class="project">
<img src="projet1.jpg" alt="Projet 1">
<h3>Nom du projet</h3>
<p>Description courte du projet</p>
</article>
<!-- Répéter pour 2 autres projets -->
</div>
</section>
<section class="contact">
<h2>Contact</h2>
<form>
<div class="form-group">
<label for="name">Nom :</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email :</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="message">Message :</label>
<textarea id="message" name="message" required></textarea>
</div>
<button type="submit">Envoyer</button>
</form>
</section>
/* Reset de base */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Style de l'en-tête */
header {
text-align: center;
padding: 40px 0;
background-color: #f8f9fa;
margin-bottom: 30px;
}
/* Section À propos */
.about {
text-align: center;
margin-bottom: 40px;
}
.profile-photo {
width: 200px;
height: 200px;
border-radius: 50%;
margin: 20px 0;
}
/* Grille de projets */
.project-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin: 20px 0;
}
.project {
border: 1px solid #ddd;
padding: 15px;
border-radius: 5px;
}
.project img {
width: 100%;
height: 200px;
object-fit: cover;
}
/* Formulaire de contact */
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input, textarea {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
Ajouter ces media queries à votre CSS :
/* Pour tablettes */
@media (max-width: 768px) {
.project-grid {
grid-template-columns: repeat(2, 1fr);
}
}
/* Pour mobiles */
@media (max-width: 480px) {
.project-grid {
grid-template-columns: 1fr;
}
header {
padding: 20px 0;
}
.profile-photo {
width: 150px;
height: 150px;
}
}
Checklist de vérification :
Q : Comment tester le responsive design ? R : Utilisez les outils de développement du navigateur (F12) et le mode responsive.
Q : Les images ne s'affichent pas ?
R : Vérifiez les chemins relatifs dans vos balises <img>.