Simple Project Using HTML and CSS with Source Code – Personal Profile Card with Navigation

By | June 21, 2025

Here is the Simple Project Using html and css with source code – Personal Profile Card with Navigation. if you are learning HTML and CSS code, you can try this Simple Project Using HTML and CSS with source code.

Here is the complete code setup that you can copy and run – just save both files to the same folder on your computer.

Simple Project Using html and css with source code – Personal Profile Card with Navigation

1. index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Profile Card with Navbar</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>

  <!-- Project 2: Navigation Bar -->
  <nav class="navbar">
    <div class="logo">MyWebsite</div>
    <ul class="nav-links">
      <li><a href="#">Home</a></li>
      <li><a href="#">About</a></li>
      <li><a href="#">Services</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </nav>

  <!-- Project 1: Profile Card -->
  <div class="card">
    <img src="https://via.placeholder.com/150" alt="Profile Picture" class="profile-img">
    <h2>Vicky</h2>
    <p class="title">Web Developer at Hostingkeeda</p>
    <p>Bihar,Patna </p>
    <button>Contact</button>
  </div>

</body>
</html>

2. style.css

/* Reset default styling */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base body styling */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f4f4f4;
  padding: 0;
  margin: 0;
}

/* Navbar Styling (Project 2) */
.navbar {
  background-color: #4a90e2;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 30px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #d0e6ff;
}

/* Profile Card Styling (Project 1) */
.card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  width: 280px;
  text-align: center;
  padding: 30px 20px;
  margin: 40px auto;
}

.profile-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 20px;
}

.title {
  color: gray;
  font-size: 16px;
  margin: 5px 0;
}

button {
  border: none;
  outline: none;
  padding: 10px 20px;
  background-color: #4a90e2;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 15px;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #357ABD;
}

How to Run This Project

  1. Open any text editor (like VS Code, Notepad++, Sublime).
  2. Create a folder (e.g., my-project).
  3. Inside that folder:
    • Save the HTML code as index.html
    • Save the CSS code as style.css
  4. Double-click index.html or right-click → “Open with browser”.

Your page will load with a navbar on top and a profile card in the center!

HTML Tags & Their Uses

TagUse / Purpose
<html>Root element of an HTML document
<head>Contains metadata like title, links, styles
<title>Sets the title of the webpage
<link>Links external CSS or favicon
<meta>Provides metadata (e.g., charset, viewport)
<body>Contains the visible content
<h1> to <h6>Headings (largest to smallest)
<p>Paragraph text
<div>Division/container for layout or styling
<nav>Represents navigation menu
<ul>Unordered list
<li>List item inside <ul> or <ol>
<a>Anchor link to another page or section
<img>Embeds an image
<button>Adds a clickable button
<span>Inline container for text styling

CSS Properties & Their Uses

PropertyUse / Purpose
colorSets text color
background-colorSets background color
font-sizeSets size of the text
font-familyDefines the font style
text-alignAligns text (left, center, right)
marginSpace outside the element
paddingSpace inside the element
borderAdds a border around elements
displaySets layout (block, inline, flex, grid)
flexDefines flex container behavior
justify-contentAligns items horizontally (in flex)
align-itemsAligns items vertically (in flex)
width / heightSets size of an element
border-radiusRounds corners of an element
box-shadowAdds shadow around an element
transitionAnimates property changes
cursorChanges the mouse pointer
hover (pseudo)Styles elements when hovered

Leave a Reply

Your email address will not be published. Required fields are marked *