
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Creating a Page with Sidebar and Main Content Area using HTML & CSS
A webpage with fluid sidebar and main content area is created by setting the size of html and body to 100%.
The following example illustrates this.
Example
<!DOCTYPE html> <html> <head> <style> html,body { height: 100%; color: white; font-size: 2em; line-height: 200px; } #parent { display: table; width: 100%; height: 100%; } #side { display: table-cell; background-color: turquoise; width: 20%; vertical-align: top; box-shadow: inset 0 0 10px black; } #main { display: table-cell; width: 80%; background: url("https://images.unsplash.com/photo-1611944444060- b50a1d80cfe6?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=800&ixlib=rb1.2.1&q=80&w=600"); } </style> </head> <body> <div id="parent"> <div id="side">Side</div> <div id="main">Main</div> </div> </body> </html>
Output
This will produce the following result −
- Related Articles
- Creating a Full Height Page with Fixed Sidebar and Scrollable Content Area in CSS
- How to create a revealing sidebar using HTML, CSS, and JavaScript?
- How to make the main content div fill height of screen with CSS and HTML
- Creating a Simple Calculator using HTML, CSS, and JavaScript
- Creating Animated Counter using HTML, CSS, and JavaScript
- Creating a Dynamic Report Card using HTML, CSS, and JavaScript
- Filtering paths and creating html page in express.js
- Creating a PDF in React JS using plain CSS and HTML
- How to create a collapsible sidebar menu with CSS and JavaScript?
- Wrap a page's content with Bootstrap
- How to create a "coming soon page" with CSS and JavaScript?
- Full page drag and drop files website with HTML
- Handling Overflowing Content using CSS
- How to create full-page tabs with CSS and JavaScript?
- How to get content of entire page using Selenium?

Advertisements