JSFiddle - React, Tailwind, and code Playground
by linoskoczek
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Author Information</title>
</head>
<body>
<div class="author-info">
<div class="triangle">
<img src="author-photo.jpg" alt="Author Photo" class="author-photo">
</div>
<div class="author-details">
<h3>John Doe</h3>
<p>John is a passionate writer with over a decade of experience in the field. He enjoys sharing insights on technology, travel, and lifestyle.</p>
</div>
</div>
</body>
</html>
CSS
body {
font-family: Arial, sans-serif;
}
.author-info {
display: flex;
align-items: center;
margin-top: 20px;
padding: 10px;
border-top: 1px solid #ccc;
}
.triangle {
width: 100px;
height: 80px; /* Height of an equilateral triangle with 100px sides */
overflow: hidden;
position: relative;
clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
background-color: #ddd;
}
.author-photo {
width: 100%;
height: auto;
display: block;
transform: translateY(-12%);
/* Adjust to center the photo within the triangle */
}
.author-details {
margin-left: 20px;
}
.author-details h3 {
margin: 0;
font-size: 1.5em;
}
.author-details p {
margin: 5px 0 0;
}