2 Column Magazine Layout Using CSS

2 Column Magazine Layout Using CSS
Code Snippet:Aesthetic Layouts: 2 Column Magazine w/ shape-outside
Author: Jhey
Published: March 21, 2024
Last Updated: March 21, 2024
Downloads: 75
License: MIT
Edit Code online: View on CodePen
Read More

This code implements a 2-column magazine layout using CSS. It structures content for readability and aesthetics. The CSS styling defines column layout and typography. The HTML organizes content into two columns for a magazine-style appearance. This layout helps present articles or blog posts in a visually appealing format.

How to Create 2 Column Magazine Layout Using CSS

1. First of all, load the Normalize CSS by adding the following CDN link into the head tag of your HTML document.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

2. Create the basic HTML structure for our magazine layout. We’ll have a <div> with a class of “content” to contain our magazine content. Inside this div, we’ll have a <header> and a <main> section with two <div> elements, each representing a column.

You can now add your content inside the columns in the HTML file. Each <div class="column"> represents a column in your magazine layout.

<div class="content">
      <header>
        <h1>001: Aesthetic Layouts</h1>
      </header>
      <main>
        <div class="columns">
          <div class="column">
            <div class="outside">
              <div class="quote-holder">
                <blockquote aria-hidden="true">The joy of pixels.</blockquote>
              </div>
            </div>
            <p>
              <span class="drop"></span>
              lorem ipsum dolor sit amet, consectetur adipisicing, elit. Eos,
              illo! Voluptatibus eos quas quasi in enim quaerat praesentium
              voluptates facilis esse, sint, laudantium similique cumque laborum
              at veniam hic sit.
            </p>
            <p>
              Ipsam quidem beatae iusto harum obcaecati expedita sint
              consequuntur, necessitatibus quos accusantium aliquam, eveniet,
              optio ad deserunt laudantium! Nobis molestias at sint est natus
              libero modi harum iusto consequatur quisquam.
            </p>
            <p>
              Earum, deserunt quaerat id sapiente quae debitis, atque voluptatum
              vitae, sint error magni architecto rerum possimus maiores porro
              aut quidem rem exercitationem. Quae quaerat reprehenderit, sit
              harum repellendus provident temporibus.
            </p>
            <p>
              Consectetur, maxime iure in, quod itaque, dolorem atque nisi
              inventore assumenda maiores veritatis aliquam illo accusantium
              molestiae ex vero. Quaerat qui minima aut consequuntur fugiat
              fugit nihil asperiores. Laborum, fugit.
            </p>
            <p>
              Ipsam, nam. Incidunt quas deserunt corporis ullam non qui aut ab
              fugiat pariatur sunt, molestias voluptatibus iste dolorum velit
              dignissimos saepe facere nihil iure quos laborum cupiditate
              dolores ducimus quaerat!
            </p>
          </div>
          <div class="column">
            <div class="outside"></div>
            <p>
              Obcaecati, quisquam ex illum aspernatur. Necessitatibus possimus
              rerum excepturi aliquid totam laboriosam reprehenderit vitae cum
              tempore porro voluptas, eaque quos saepe recusandae molestiae
              maiores labore modi fuga adipisci eius odit.
            </p>
            <p>
              Cum amet recusandae doloremque aspernatur veniam eligendi magnam
              laborum atque aliquid aperiam corrupti doloribus accusamus dicta
              soluta eius, non, dolorum expedita voluptas libero quas obcaecati
              eaque aliquam! Recusandae, ex alias.
            </p>
            <p>
              Adipisci tenetur libero quis aspernatur at quas reiciendis beatae
              ut nisi velit est dolores sunt illum dignissimos deserunt
              recusandae, dolorum culpa? Sed accusantium modi labore repellendus
              unde, quos dicta nulla?
            </p>
            <p>
              Eius velit, quaerat exercitationem voluptatem officia facere
              quibusdam nisi odio veritatis id rerum nesciunt et quis
              perferendis modi architecto magnam similique neque. Dolores quae
              aliquid officiis quaerat debitis excepturi ullam.
            </p>
            <p>
              Deleniti quas vero perspiciatis quae placeat pariatur officia
              officiis dolores dicta totam cum consequatur similique, iste
              veritatis quos distinctio dolor voluptatum, odio. Cupiditate sed
              doloribus provident ullam at dolorem beatae!
            </p>
          </div>
        </div>
      </main>
    </div>
    <a
      class="bear-link"
      href="https://twitter.com/intent/follow?screen_name=jh3yy"
      target="_blank"
      rel="noreferrer noopener"
    >
      <svg
        class="w-9"
        viewBox="0 0 969 955"
        fill="none"
        xmlns="http://www.w3.org/2000/svg"
      >
        <circle
          cx="161.191"
          cy="320.191"
          r="133.191"
          stroke="currentColor"
          stroke-width="20"
        ></circle>
        <circle
          cx="806.809"
          cy="320.191"
          r="133.191"
          stroke="currentColor"
          stroke-width="20"
        ></circle>
        <circle
          cx="695.019"
          cy="587.733"
          r="31.4016"
          fill="currentColor"
        ></circle>
        <circle
          cx="272.981"
          cy="587.733"
          r="31.4016"
          fill="currentColor"
        ></circle>
        <path
          d="M564.388 712.083C564.388 743.994 526.035 779.911 483.372 779.911C440.709 779.911 402.356 743.994 402.356 712.083C402.356 680.173 440.709 664.353 483.372 664.353C526.035 664.353 564.388 680.173 564.388 712.083Z"
          fill="currentColor"
        ></path>
        <rect
          x="310.42"
          y="448.31"
          width="343.468"
          height="51.4986"
          fill="#FF1E1E"
        ></rect>
        <path
          fill-rule="evenodd"
          clip-rule="evenodd"
          d="M745.643 288.24C815.368 344.185 854.539 432.623 854.539 511.741H614.938V454.652C614.938 433.113 597.477 415.652 575.938 415.652H388.37C366.831 415.652 349.37 433.113 349.37 454.652V511.741L110.949 511.741C110.949 432.623 150.12 344.185 219.845 288.24C289.57 232.295 384.138 200.865 482.744 200.865C581.35 200.865 675.918 232.295 745.643 288.24Z"
          fill="currentColor"
        ></path>
      </svg>
    </a>

3. Now, let’s style our magazine layout using CSS. We’ll define the column layout, typography, and other visual elements.

*,
*:after,
*:before {
	box-sizing: border-box;
}

html {
	color-scheme: light only;
}

body {
	min-height: 100vh;
	font-family:  "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue", Helvetica, Arial, sans-serif, system-ui;
}

body::before {
  --size: 60px;
  --line: hsl(0 0% 0% / 0.15);
  content: &singleQuote;&singleQuote;;
  height: 100vh;
  width: 100vw;
  position: fixed;
  background: linear-gradient(
        90deg,
        var(--line) 1px,
        transparent 1px var(--size)
      )
      50% 50% / var(--size) var(--size),
    linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
      var(--size) var(--size);
  -webkit-mask: linear-gradient(-15deg, transparent 30%, white);
          mask: linear-gradient(-15deg, transparent 30%, white);
  top: 0;
  transform-style: flat;
  pointer-events: none;
  z-index: -1;
}

h1 {
	margin: 0;
	font-family: monospace;
	text-transform: uppercase;
}

header {
	padding: 8rem 0 2rem;
}

.content {
	width: 700px;
	max-width: calc(100% - 2rem);
	margin: 0 auto;
}

.drop {
	--drop: clamp(1.5rem, 1vw + 1rem, 6rem); 	
	height: var(--drop);
	width: calc(var(--drop) * 2.25);
	aspect-ratio: 4 / 3;
	float: left;
	position: relative;
	shape-outside: inset(0 0 0 0);
}

.drop::after {
	content: "CSS";
	position: absolute;
	inset: 0;
	display: grid;
	line-height: 2rem;
	font-size: calc(var(--drop) * 1);
	font-weight: 600;
	text-align: left;
	place-items: start;
}

.quote-holder {
	position: absolute;
	left: calc(100% + (var(--gap) * 0.5));
	top: calc(var(--y) * 1%);
	height: calc(var(--size) * 2px);
	aspect-ratio: 1;
	background: radial-gradient(white 0% 50%, transparent 70%);
	translate: -50% -50%;
	border-radius: 50%;
	margin: 0;
	font-weight: 600;
	font-size: 1.5rem;
	text-align: center;
	container-type: inline-size;
	display: grid;
	place-items: center;
}

blockquote {
	margin: 0;
	text-align: center;
	font-size: 14cqi;
}

.columns {
	display: flex;
	gap: var(--gap);
}

:root {
	--size: 100;
	--y: 200;
	--x: 50;
	--gap: 1rem;
}

.outside {
	position: relative;
	width: calc(var(--size) * 1px);
	height: calc(100% + (var(--size) * 1px));
}

.column:first-of-type .outside {
	float: right;
  shape-outside: circle(calc(var(--size) * 1px) at 100% calc(var(--y) * 1%));
}
.column:last-of-type .outside {
	float: left;
  shape-outside: circle(calc(var(--size) * 1px) at 0 calc(var(--y) * 1%));
}

.columns p {
	font-size: .875rem;
	text-align: justify;
}

.outside {
	float: right;
	shape-outside: circle(50%);
}
/* Social */
.bear-link {
  color: canvasText;
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  opacity: 0.8;
}

:where(.x-link, .bear-link):is(:hover, :focus-visible) {
  opacity: 1;
}
.bear-link svg {
  width: 75%;
}

Feel free to adjust the CSS to customize the layout further according to your preferences. You can experiment with fonts, colors, and spacing to achieve the desired look for your magazine layout.

That’s all! hopefully, you have successfully created 2 Column Magazine Layout for your website. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X