Metadata
- đź“… Date :: 21-06-2025
- 🏷️ Tags :: web-dev
Notes
Building a Landing Page with Bootstrap: The TinDog Project
This project-based lesson demonstrates how to apply all the learned Bootstrap concepts to build a responsive and visually appealing landing page for a fictional startup called “TinDog” (Tinder for dogs).
1. Project Overview: TinDog Landing Page
- Concept: A modern, single-page website for a dog-matching app.
- Key Sections:
- Title Section: Hero section with app download buttons and a phone image.
- Features Section: Highlights key benefits with icons.
- Testimonials Section: Carousel for customer reviews, and a section for featured outlets.
- Pricing Section: Displays different pricing tiers.
- Footer Section: Standard footer with copyright and links.
- Tools: Primarily Bootstrap components, layout (grid), utility classes, and a small amount of custom CSS.
2. Project Setup and Resources
- Starting Files: Download the “TinDog project” zip file.
index.html: Contains pre-defined<section>elements for different parts of the website, helping organize your code.README.md: Important resource for:- Goal Images: Visual targets for each section.
- SVG Icons: Pre-copied SVG code for various icons (Apple, Google Play, Checkmark, Hat, Heart, etc.). Use these directly rather than fetching from Bootstrap’s icon site to maintain consistent sizing and styling.
- Text Copy: All the written content for the website, mimicking a common workflow where clients provide text.
style.css: Includes a pre-definedgradient-backgroundclass for an animated CSS gradient.- To use it, add
class="gradient-background"to the desired HTML element (e.g.,<section>).
- To use it, add
3. Building the Website Section by Section
3.1. Title Section (Hero)
- Goal: Large heading, two “Download” buttons with app store icons, and a phone image.
- Bootstrap Snippet: Look for “Heroes” in Bootstrap Examples. The “Centered screenshot” example is a good starting point.
- Steps:
-
Copy HTML: Copy the
divelement containing the hero section from the Bootstrap example. -
Paste: Paste it into the
<section id="title">inindex.html. -
Include Bootstrap CSS: Crucial step! If your page looks unstyled, ensure you’ve linked the Bootstrap CDN CSS in your
<head>section:<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> -
Include Custom CSS: Link your
style.cssafter the Bootstrap CSS to allow for overrides:<link rel="stylesheet" href="css/style.css"> -
Replace Image: Change the
srcof the<img>tag toimages/iphone.pngand adjustheight(e.g.,200px) for better scaling. Addalt="app demo". -
Update Text: Copy and paste the main heading (
<h1>) text and button text fromREADME.md. Remove the extra paragraph element if not needed. -
Add SVG Icons: Copy the Apple and Google Play SVG code from
README.mdand paste them next to the “Download” text inside their respective buttons. -
Button Styling: Change
btn-primarytobtn-lightandbtn-outline-secondarytobtn-outline-lightfor the download buttons to match the design. -
Animated Background: Add the
gradient-backgroundclass to the<section id="title">element:<section id="title" class="gradient-background"> </section> -
Adjust Padding: Remove
py-5(padding-top and padding-bottom 5) from the innercontainerordivif it causes excessive spacing. If you only want top padding, changepy-5topt-5. The goal is to have the gradient extend fully while content is spaced correctly.
-
3.2. Features Section
- Goal: Three columns, each with an icon, heading, and descriptive text.
- Bootstrap Snippet: Look for “Features” in Bootstrap Examples (the first example is ideal).
- Steps:
-
Copy HTML: Copy the
div.rowcontaining the feature columns. -
Paste & Wrap: Paste into
<section id="features">. Crucially, wrap thisdiv.rowwithin adivwithclass="container"to align it with other sections. -
Remove Buttons: Delete the
<a>(anchor) tags that act as buttons within each feature column, as they are not part of the design. -
Update Text: Copy and paste headings (
<h3>) and paragraph (<p>) text for each feature fromREADME.md. -
Replace SVG Icons: Replace the example SVGs with
<img>tags referencingimages/checkmark.svg,images/mortarboard.svg(graduation hat), andimages/heart.svgfrom yourimagesfolder. Addalttext and setheight="30px"for consistent icon sizing. -
Custom Icon Styling: The circular background for icons is not default Bootstrap.
- Inspect: Use Chrome DevTools to inspect the desired styling from the Bootstrap Features example.
- Identify Custom CSS: Look for CSS rules that don’t come from
utilities.cssor similar general Bootstrap files (e.g., rules foricon-square). - Copy & Paste CSS: Copy this custom CSS (e.g., for
.icon-square) from the DevTools “Styles” tab into yourstyle.cssfile. - Apply Class: Ensure the
divwrapping your icon has the correct class (e.g.,class="icon-square").
-
Section Margin: Add
mt-5(margin-top 5) to thediv.containerof the features section to provide spacing from the title section:<div class="container mt-5"> </div>
-
3.3. Testimonials Section
-
Goal: A rotating carousel with dog images and quotes, followed by a section featuring company logos.
-
Steps (Carousel):
- Bootstrap Snippet: Go to “Components” → “Carousel” in Bootstrap docs. Find a basic example with indicators and images.
- Copy & Paste: Copy the Carousel HTML into
<section id="testimonials">. - Wrap in Container: Wrap the entire carousel
divinside adivwithclass="container"to ensure alignment. - Update Images: Set
srcfor carousel<img>tags toimages/couple.jpg,images/dog-img.jpg, andimages/lady-img.jpg. Addalttext. - Adjust Text: Change the
<h1>to<h2>for the main quote, as<h1>should only appear once per page. Update the text within the<h2>and paragraph elements with quotes/names fromREADME.md. - Profile Image Styling:
-
Add a custom class like
profile-imgto your dog profile image (e.g.,dog-img.jpg). -
In
style.css, define rules for.profile-img:.profile-img { height: 100px; border-radius: 50%; /* Makes image circular */ } -
Add
mt-5to theprofile-imgfor vertical spacing. -
Add
mt-2to the text below the image for spacing.
-
-
Steps (Featured Logos):
- Grid Layout: Below the carousel (but still within the testimonials section), create a new
divwithclass="container"and inside that adivwithclass="row". - Columns: For each logo, create a
divwith responsive column classes. The goal specified “3 columns on desktop, 12 on mobile”:class="col-lg-3 col-sm-12". - Add Images: Inside each column, place an
<img>tag forimages/techcrunch.png,images/mashable.png,images/bizinsider.png, andimages/tnw.png. Addalttext. - Image Sizing: Set
height="30px"on each logo<img>for consistent sizing.
- Grid Layout: Below the carousel (but still within the testimonials section), create a new
3.4. Pricing Section
- Goal: Three pricing cards with details and a button, preceded by a title and subtitle.
- Bootstrap Snippet: Look for “Examples” → “Pricing” in Bootstrap docs. The three-card layout is perfect.
- Steps:
- Copy HTML (Pricing Table): Copy the
div.rowcontaining the three pricing cards. - Paste & Wrap: Paste into
<section id="pricing">. Wrap thisdiv.rowwithin adivwithclass="container". - Copy HTML (Title): Copy the
divcontaining the pricing title and subtitle from the Bootstrap example. - Paste Title: Paste it at the beginning of your pricing
div.container. - Update Text: Replace all text within the pricing cards and the title/subtitle with content from
README.md. Change the<h1>for the pricing title to<h2>. - Color Scheme: The example uses Bootstrap’s primary blue. Your goal is a “dark” scheme.
- Use Ctrl+F (Cmd+F) to search for “primary” within the pricing section’s HTML.
- Carefully replace
btn-primarywithbtn-darkandbtn-outline-primarywithbtn-outline-darkwhere appropriate. Do not use “Replace All” globally as it might affect unintended areas.
- Copy HTML (Pricing Table): Copy the
3.5. Footer Section
- Goal: Simple footer with copyright and possibly social links.
- Bootstrap Snippet: Look for “Snippets” → “Footers” in Bootstrap Examples. Choose a simple one.
- Steps:
- Copy HTML: Copy the
div.containerfor the footer. - Paste: Paste into
<section id="footer">. - Remove Logo: Delete the
<a>tag that links to the Bootstrap logo. - Update Copyright: Change the paragraph text to
© Copyright TinDog. - Remove Border: Locate and remove the
border-topclass from the relevant footer element (e.g., thefootertag itself or a containerdiv) if it’s present and not desired. - Animated Background: Add the
gradient-backgroundclass to the<section id="footer">element. - Adjust Margin: If there’s unwanted white space at the bottom, look for
my-5(margin-y 5) or similar margin classes in the footer’s parent elements (like the container). Changemy-5tomt-5to keep top margin but remove bottom margin.
- Copy HTML: Copy the
4. Key Takeaways from the Project
- Rapid Development: Bootstrap significantly speeds up the creation of complex, modern websites.
- Component-Based Design: Leveraging pre-built components (buttons, cards, navbars, carousels) is central to efficient Bootstrap development.
- Responsive by Default: Bootstrap’s grid system and components are designed to be responsive, adapting well to different screen sizes.
- Customization: While Bootstrap provides strong defaults, you can customize it by:
- Overriding CSS (ensure your custom CSS loads after Bootstrap).
- Replacing text and images.
- Using SVG icons directly or via image tags.
- Workflow: Common web development involves taking client-provided text (“copy”) and integrating it into pre-designed or framework-based layouts.
- Bootstrap vs. Native CSS (Flexbox/Grid):
- Bootstrap: Excellent for quickly “throwing down components” and achieving a modern look with consistent design. Ideal for rapid prototyping and general-purpose websites.
- Flexbox/Grid (Native CSS): Offer more granular control for highly custom or “pixel-perfect” layouts. Essential for understanding underlying CSS principles and for bespoke designs.