If you’re looking for “paragraph hero” code, it likely refers to a section or component in HTML/CSS that acts as a prominent, large text block (often used for hero sections on websites). Here’s a basic example of what a “hero” section with a paragraph could look like in HTML and CSS:
HTML (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Paragraph Hero Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<section class="hero">
<div class="hero-content">
<h1 class="hero-title">Welcome to Our Website</h1>
<p class="hero-paragraph">We provide innovative solutions to help your business grow and succeed in the digital world.</p>
</div>
</section>
</body>
</html>
CSS (styles.css)
/* Basic Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
}
/* Hero Section */
.hero {
background-image: url('your-image.jpg'); /* Replace with your background image */
background-size: cover;
background-position: center;
color: white;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
padding: 0 20px;
}
.hero-content {
max-width: 800px;
}
.hero-title {
font-size: 3rem;
font-weight: bold;
margin-bottom: 20px;
}
.hero-paragraph {
font-size: 1.5rem;
line-height: 1.6;
}
Explanation:
- HTML: This structure contains a
<section>
with the classhero
. Inside the hero section, there is a heading (<h1>
) and a paragraph (<p>
), which represent the title and the main message of the hero section. - CSS:
- The
.hero
class makes the section take up the full viewport height (100vh
), and it includes a background image (you can replaceyour-image.jpg
with a real image path). - The
.hero-content
class is used to center and constrain the text content within a certain width. - The
hero-title
andhero-paragraph
styles control the typography and spacing to make the text stand out.
- The
Notes:
- Replace
'your-image.jpg'
with an actual image path that you’d like to use for the background. - You can modify the
font-size
,line-height
, and other properties to suit your design needs.