Jive Factory: Starting the Header
Master Responsive Header Design with Mobile-First Approach
This tutorial follows a mobile-first approach, starting with styles for small screens and progressively enhancing for larger devices. This ensures optimal performance and user experience across all device types.
Tutorial Learning Path
Add Header Content
Copy and paste pre-written HTML code for logo and navigation elements into the header structure.
Mobile Styling
Apply mobile-first CSS styles using inline-block display for flexible responsive behavior.
Progressive Enhancement
Add specific styles for phablets and tablets using media queries and responsive design principles.
This exercise builds upon previous work. If you haven't completed exercises 2D-3B, follow the setup instructions to start with the provided 'Jive Background Done' folder to ensure all foundational code is in place.
Header Structure Components
Company Info Section
Contains the logo and details div with address and business hours information. Uses company-info class for styling control.
Navigation Element
Standard nav element containing an unordered list of site links. Provides main site navigation functionality.
This tutorial uses display: inline-block instead of floats for side-by-side content, providing more flexibility with styles across different responsive breakpoints.
CSS Specificity Solution Process
Identify Override Issue
CSS class rules have higher specificity than tag rules, causing style conflicts with the module class.
Increase Specificity
Add .module to the header selector to match the specificity level and ensure styles apply correctly.
Use Negative Margins
Apply negative margins equal to body padding (-25px top, -15px sides) to pull header to full width.
Hiding the Shows link on mobile reduces navigation clutter since the slideshow content is also hidden at this breakpoint. The link reappears at larger screen sizes where space allows.
Mobile vs Phablet Navigation Spacing
| Feature | Mobile (< 480px) | Phablet (480-739px) |
|---|---|---|
| Navigation Margins | Default spacing | 15px left/right |
| Shows Link | Hidden | Visible |
| Content Alignment | Centered | Centered |
SVG Logo Scaling Approach
Tablet Layout Transformation Process
Change Text Alignment
Switch from centered to left-aligned text for more traditional desktop-style layout approach.
Apply Float Layout
Float company-info left and navigation right to create horizontal distribution of header elements.
Fix Container Collapse
Add clearfix class to header element to prevent float-induced container height collapse issues.
Create Layered Effect
Use negative margins on logo to create visual effect of logo extending outside the header band.
Key Takeaways
