Programming Examples
Write an HTML code to generate the following layout:
Write an HTML code to generate the following layout:
A webpage with a 2-row, 3-column grid layout displaying:
a. Top Row:
- Column 1: "Header: Student Profile" (highlighted in bold, orange background)
- (spans across all 3 columns)
b. Second Row (3 Columns):
- Column 1: "Personal Details"
Solution<!DOCTYPE html>
<html>
<head>
<title>Student Profile Layout</title>
<style>
table {
width: 80%;
border-collapse: collapse;
margin: 20px auto;
text-align: center;
}
th, td {
border: 1px solid #555;
padding: 20px;
}
.header {
background-color: orange;
font-weight: bold;
font-size: 20px;
}
.column {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<table>
<!-- Top Row: Header spanning all 3 columns -->
<tr>
<th class="header" colspan="3">Header: Student Profile</th>
</tr>
<!-- Second Row: 3 Columns -->
<tr>
<td class="column">Personal Details</td>
<td class="column">Academic Details</td>
<td class="column">Contact Details</td>
</tr>
</table>
</body>
</html>
▶ RUN Output/ Explanation: