How To Create Columns In HTML

ExploreEXPLORE THE CATALOGSupercharge your career with 700+ hands-on coursesView All CoursesPythonJavaJavaScriptCReactDockerVue JSRWeb DevDevOpsAWSC#LEARNING TOOLSExplore the industry's most complete learning platformCoursesLevel up your skillsSkill PathsAchieve learning goalsProjectsBuild real-world applicationsMock InterviewsNewAI-Powered interviewsPersonalized PathsGet the right resources for your goalsLEARN TO CODECheck out our beginner friendly courses.PricingFor BusinessResourcesBlogFor developers, By developersCheatsheetsDownload handy guides for tech topicsWebinarsSessions with our global developer communityAnswersTrusted answers to developer questionsSearchCoursesLog InJoin for freeHow to create columns in HTML

HTML columns are essential for organizing data in a structured manner, facilitating clear comparisons between two or more items. By dividing content into columns, you can enhance readability and streamline information presentation on our web pages. In this answer, we will explore how to create columns in an HTML page.

Defining columns in HTML

An HTML column is defined in the <div> tag using the class = "column" keyword. More columns can be added by adding more divs with the same class. The following syntax is used to add columns in HTML.

  • <div class="row"> tag is used to initialize the row where all the columns will be added.
  • <div class="column" > tag is used to add the corresponding number of columns.
  • style="background-color:#aaa;" property is used to give color to the column.
  • Individual properties, such as width: 50%;, are added to the columns in the style sheet for that particular div.
svg viewer

Example

Below is an example of how to create 2 basic columns in HTML.

Multiple columns

HTML also allows the creation of more than two columns in a single row; we can set varying widths for these columns by specifying them in the style sheet.

Relevant Answers

Explore Courses

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved

Learn in-demand tech skills in half the time

PRODUCTS

Mock Interview

New

Courses

Skill Paths

Projects

Assessments

TRENDING TOPICS

Learn to Code

Tech Interview Prep

Generative AI

Data Science

Machine Learning

GitHub Students Scholarship

Early Access Courses

Blind 75

Layoffs

Pricing

For Individuals

Try for Free

Gift a Subscription

CONTRIBUTE

Become an Author

Become an Affiliate

Earn Referral Credits

RESOURCES

Blog

Cheatsheets

Webinars

Answers

ABOUT US

Our Team

Careers

Hiring

Frequently Asked Questions

Contact Us

Press

LEGAL

Privacy Policy

Cookie Policy

Terms of Service

Business Terms of Service

Data Processing Agreement

INTERVIEW PREP COURSES

Grokking the Modern System Design Interview

Grokking the Product Architecture Design Interview

Grokking the Coding Interview Patterns

Machine Learning System Design

Tiktok Streamline Icon: https://streamlinehq.com

Copyright ©2024 Educative, Inc. All rights reserved.

soc2

Từ khóa » Html Css Div 2 Column Layout