School-HTML/3AIN/Esercizi TPS Vichi per 2025.../Esercizio1.html

97 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<title>Trova la parola più lunga in una frase</title>
<style>
body {
background-color: #f4f6f8;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #333;
margin: 0;
padding: 40px;
display: flex;
flex-direction: column;
align-items: center;
-webkit-user-select: none;
-webkit-touch-callout: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
h1 {
color: #2c3e50;
margin-bottom: 20px;
}
textarea {
width: 100%;
max-width: 700px;
height: 120px;
padding: 15px;
border: 1px solid #ccc;
border-radius: 8px;
resize: vertical;
font-size: 16px;
box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}
button {
margin-top: 20px;
padding: 12px 24px;
font-size: 16px;
background-color: #3498db;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #2980b9;
}
.result, .occurrence {
margin-top: 30px;
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
width: 100%;
max-width: 700px;
}
.occurrence ul {
padding-left: 20px;
margin-top: 10px;
}
.occurrence li {
line-height: 1.6;
}
@media (max-width: 768px) {
body {
padding: 20px;
}
textarea, .result, .occurrence {
width: 100%;
}
}
</style>
</head>
<body>
<h1>Trova la parola più lunga in una frase</h1>
<textarea id="textInput" placeholder="Inserisci una frase..."></textarea><br>
<button onclick="esercizio1()">Analizza</button>
<div class="result"><strong id="longestWordResult"></strong></div>
<div class="occurrence" id="wordOccurrences"></div>
<script src="esercizi.js"></script>
</body>
</html>