How to Create a Tropical Stationery Set in Adobe InDesign

Post pobrano z: How to Create a Tropical Stationery Set in Adobe InDesign

Final product image
What You’ll Be Creating

Tropical and botanical patterns are a big trend in brand design right now. Channel the nature-inspired look with this letterhead and business card set—perfect for making great first impressions with new clients.

In this tutorial suitable for beginners to Adobe InDesign, we’ll look at how to lay out the card and letterhead and prepare them for printing.

Looking for a quick stationery fix? You can download and adapt lots of easy-to-edit stationery templates from Envato Elements and GraphicRiver.

What You’ll Need to Create Your Stationery Set

You’ll need access to Adobe InDesign, and to download the following patterns and font files:

1. How to Set Up the Stationery Document in InDesign

Step 1

Open InDesign and go to File > New > Document. 

Set the Width of the page to 2 in and Height to 3.5 in. Increase the Number of Pages to 4, and uncheck Facing Pages. 

Add Margins of 0.1875 in and a Bleed of 0.125 in, before clicking Create.

new document

Step 2

Expand the Layers panel (Window > Layers) and double-click on the Layer 1 name, renaming it Pattern

Create a second new layer, and name this Type

new layer

Lock the Type layer, and click on Pattern to activate it. 

pattern layer

2. How to Create Your Business Card

Step 1

Select the Rectangle Frame Tool (F) and drag across the whole of Page 1, extending the edges up to the edge of the bleed. 

rectangle frame

Go to File > Place, navigate to the ‘patt2.jpg’ file in the Tropical Accent pattern folder, and click Open. Allow it to fill up the whole image frame. 

pattern image

Step 2

Lock the Pattern layer and unlock the layer above, Type

Use the Rectangle Tool (M) to create a shape across the page, extending its edges up to the margin line. From the Swatches panel, set the Fill of the shape to [Paper].

rectangle shape

Step 3

Switch to the Type Tool (T) and create a text frame centrally on the card, about a third of the way down. 

Type in the name of the person or business, and from either the top Controls panel or the Character and Paragraph panels (Window > Type & Tables > Character / Paragraph), set the Font to Abside Smooth, Size 11 pt, Leading 17 pt, Tracking 60, All Caps, and set the text to Align Center.

name text

Step 4

Create a second text frame below the first and type in the occupation of the person. 

Set the Font to Abside Round 1, Size 9 pt, Tracking 60, and Align Center. 

occupation text

Step 5

Add a final text frame below this, listing the website, email and phone number of the business, setting the Font to Abside Smooth, Size 7 pt, Leading 13 pt, Tracking 60, and Align Center. 

contact details

Step 6

Unlock the Pattern layer and select the image frame containing the pattern. Edit > Copy it.

Scroll down to Page 2 of your document and Edit > Paste in Place.

pattern

The artwork for your business card is finished—great job! Now we can work on creating a letterhead with a matching style within the same InDesign document.

business card

3. How to Create Your Letterhead

Step 1

Scroll down to Page 3 of your document.

Select the Page Tool (Shift-P) and click onto the page to select it. 

page tool

In the top Controls panel, adjust the Width (W) of the page to 8.5 in and Height (H) to 11 in, to expand the page to a US Letter size. 

page tool controls

Step 2

With the page still selected using the Page Tool, go to Layout > Margins and Columns. 

Increase the Margins to 0.3125 in, and click OK

margins

Scroll down to Page 4, and repeat the process to expand this to a Letter size as well, with a 0.3125 in Margin.

margins and columns

Step 3

Head back up to Page 3 and Edit > Paste to drop a pattern image frame onto the page. 

Expand the edges of the frame to fit the larger page size, and allow the image to scale up, so that it fills the frame completely. 

pattern background

Step 4

Remaining on Page 3, unlock the Type layer and use the Rectangle Tool (M) to create a shape across the page, extending it up to the margin edge. 

Set the Fill of the shape to [Paper].

paper rectangle

Step 5

Copy the name and occupation text frames from Page 1, and Paste them onto Page 3. 

Move the text frame towards the top of the white shape, and increase the Font Size a little, to make it more proportional for the letter page size.

type layer

Step 6

Create a header text frame below, set in Abside Smooth. 

Then create another text frame below this for a sub-heading, setting the Font to Domani, Size 12 pt. 

domani font

Use the Line Tool (\) to create small bounding lines above and below the header and sub-heading frames. From the Stroke panel (Window > Stroke), set the Weight to 2 pt, and adjust the Cap to a Round Cap.

stroke panel

Step 7

Create a large text frame across the main body of the page. Set your Type Tool cursor in the frame and set the Font to Domani, Size 9 pt, Leading 16 pt, Tracking 60. 

You can type in your body text here, or go to Type > Fill with Placeholder Text, to place filler text in the frame for now. 

body text

Step 8

Add a trio of text frames along the bottom of the letter, setting contact details in each. 

Set the Font to Abside Smooth, Size 9 pt. 

abside font

Use the Line Tool (\) to add two small vertical dividers between each item of text, setting the Weight to 1 pt and adding a Round Cap.

stroke panel

Step 9

To create the reverse side of your letterhead, unlock the Pattern layer and Edit > Copy the pattern image frame sitting on Page 3. 

Scroll down to Page 4 and Edit > Paste in Place. Pull back the edges of the image frame, until they hit the margin line, leaving a blank margin around the edge of the page. 

pattern image

Unlock the Type layer, scroll up to Page 3, and Copy the name and occupation text frames from the top of the page. Head back down to Page 4 and Edit > Paste them onto the page. 

Move them onto the center of the page, adjust the Font Color to [Paper], and increase the Font Size until the text looks more proportional. 

text paper

Great work! Your letterhead artwork is finished and ready for exporting.

letterhead

4. How to Export Your Stationery Set for Printing

Step 1

Go to File > Export. In the Export window, name the file something like ‘Letterhead and business card for print’ and choose Adobe PDF (Print) from the Format menu at the bottom of the window. Then click Save

In the Export Adobe PDF window that opens, choose [Press Quality] from the Preset menu at the top, and make sure that Pages is set to export All. 

press quality

Step 2

Click on Marks and Bleeds in the window’s left-hand menu. 

Check both All Printer’s Marks and Use Document Bleed Settings, before clicking Export

marks and bleeds

Conclusion: Your Finished Stationery Set

Your tropical stationery set is ready for sending straight off to print—awesome work!

final set

We’ve covered a wide range of print design skills over the course of this tutorial. You now know how to create stationery documents in InDesign, import graphic patterns to add style and flair, and format typography to a high standard, as well as using the Page Tool to adjust page sizes as you work.

On the hunt for more great stationery styles? You can find lots of easy-to-edit stationery templates over on Envato Elements and GraphicRiver.

Or why not try out another stationery design tutorial?

How to Create a Beach Guard Tower Illustration in Adobe Illustrator

Post pobrano z: How to Create a Beach Guard Tower Illustration in Adobe Illustrator

Final product image
What You’ll Be Creating

In today’s tutorial we are going to get into summer vibes while creating a lonely beach guard tower on a seashore in Adobe Illustrator. We will use simple tools and techniques.

As usual, you can purchase the result as a part of my Summer Seaside collection on GraphicRiver.

Summer Seaside Collection on Graphicriver

1. How to Create a New Document

First, set up a New Document (File > New or Control/Command-N) with these settings:

  • Number of Artboards: 1
  • Width: 1200
  • Height: 1200
  • Units: pixels

From the Advanced tab:

  • Color Mode: RGB
  • Raster Effects: Screen
  • Preview Mode: Default
  • Uncheck Align New Objects to Pixel Grid
Creating a New Document

2. How to Create the Top Section of the Tower

Step1

Let’s start simple by creating a 127 x 127 px rectangle and filling it with #98D2BE.

Take the Direct Selection Tool (A) and select both top anchors of the rectangle. Press Enter to open the Move window. Set the Horizontal value to -32 px and the Vertical value to 0 px and press OK, moving our anchors to the left.

This angled rectangle will act as a main front wall.

Building a Rectangle

Step 2

Select the shape and Copy it, using Control-C. Click Control-F twice to get two copies on the top of the rectangle, and move the top copy to the right by about 60 px.

Add the second copy to the selection and use the Minus Front option of the Pathfinder panel.

Copying the Rectangle and Using the Minus Front Option

Step 3

Select the resulting shape with the Selection Tool (V) and reduce its size by Shift-dragging one of the top corners of the Bounding Box blue area to the center.

Set the color of the shape to #48A987 and position the shape in the middle part of the wall. It will act as a doorway.

Forming a Doorway

Step 4

Copy (Control-C) the doorway and paste two copies in the front by pressing Control-F twice.

Move the top shape slightly to the right, add a second copy to the selection, and press the Intersect button on the Pathfinder panel. Change the color of the new shape to #225443, forming the inner shadow part of the entrance.

Forming a Shadow Part for the Doorway

Step 5

Now we are going to add a shadow to the entrance wall. Make two copies (Control-C) and paste them in front of the shape (Control-F twice), and move the top copy to the left and down.

Add a second shape to the selection using the Minus Front option of Pathfinder, getting an angled shape.

Since it will act as a shadow, change its Blending Mode to Multiply while lowering the Opacity to 40% in the Transparency panel.

Building a Shadow

Step 6

Let’s add a highlight on the right part of the wall.

Create two front copies of the wall again and move the top copy to the right. Add another copy to the selection while using the Minus Front option of Pathfinder, making sure to change the resulting shape’s color to white (#FFFFFF).

Building a Highlight

Step 7

Time to add outlines to the shapes.

Select the main rectangle and copy it. Then click once on the shadow doorway part and press Control-F, getting a copy of the wall in front of the entrance.

Set the Fill of the copy to None, the Stroke color to #3d342d, and the Weight to 6 px.

Give 6 px thick outlines (#3d342d) to the doorway parts.

Adding Outlines

Step 8

Build a 152 x 127 px rectangle (#6ebea2) for the side wall, placing its top-left anchor behind the top-right anchor of the front wall and hiding it behind the previous section.

As we did with the previous wall, give the current one a shadow part by making two front copies, moving the top copy to the left and bottom and using the Minus Front option of the Pathfinder for the two shapes, making sure to change the Blending Mode of the resulting shape to Multiply while lowering the Opacity to 40%. 

Building a Side Wall

Step 9

Working the same way, add one more side shadow on the wall.

Let’s add an outline to the side wall. Copy (Control-C) the side wall, click on the upper shadow, and paste the shape in front of it with Control-F. Remove the Fill while setting the Stroke color to #3d342d and the Weight to 6 px.

Adding Shadows for the Side Wall

Step 10

Add a 210 x 16.5 px rectangle (#6ebea2) on the top of the side wall and align it to the center of the shape.

As we did for the previous sections, give the current rectangle two shadows and a 6 px thick outline (#3d342d).

Building a Rectangle Over the Side Wall

Step 11

Form a 129 x 16.5 px rectangle (#98d2be) on the outer left side of the previously created shape.

Using the same methods, build a highlight on the left part and a shadow on the right side of the stripe, followed by a 6 px wide outline (#3d342d).

Group (Control-G) all the parts together.

Forming an Upper Rectangle

3. How to Create the Bottom Section of the Tower

Step 1

Let’s start working on the bottom section of our tower by forming a 290 x 16.5 px rectangle (#48a987) below the upper section, aligning it to the right edge of the roof.

Make one more 230.5 x 16.5 px stripe of the same color under the first one.

Rotate the rectangle by 30 degrees by Alt-clicking on the bottom-left anchor with the Rotate tool (R), setting the Angle to 30 degrees.

Attached the angled shape to the left side of the horizontal one, positioning its top anchor on the top-left anchor of the horizontal rectangle.

Building to Rectangles on the Bottom

Step 2

Select the angled rectangle and press Enter to open the Move option window. Set the Horizontal value to -100 px and the Vertical value to 0 px and press Copy, getting a duplicate on the left side.

Take the Direct Selection Tool (A) and drag the bottom-right anchor of the duplicate onto the top point of the original angled shape.

Then select the bottom-left anchor of the left angled shape and position it on the top-left anchor of the original rectangle.

Set the color of the resulting shape to #98d2be.

Forming an Angled Shape

Step 3

Take the Rectangle Tool (M) and add a small rectangle (#48a987) under the bottom side of the large angled shape, making sure to place its lower edge on the same level as the bottom anchor of the right angled stripe.

Select the lower edge of the created figure with the Direct Selection Tool (A) and drag it to the right, positioning its right side on the left edge of the neighboring angled stripe.

Building Side Parts for the Angled Shape

Step 4

Now let’s work on the highlights.

Make a larger copy of the side angled rectangle. Select it together with the original shape and the horizontal rectangle and cut off the outstanding part by Alt-clicking on it with the Shape Builder Tool (Shift-M). Change the color of the resulting shape to white (#ffffff).

Using the Pathfinder method, as we did before, add a second highlight to the slope.

Adding Highlights

Step 5

Give shadows to the horizontal side stripe and the slope.

Select the angled rectangle and horizontal stripe and unite the two into a single larger shape using Pathfinder’s Unite Shape Mode.

Add 6 px thick outlines (#3d342d)  with a Round Join to all the bottom pieces.

Adding Shadows on the Bottom Parts

Step 6

Start working on the fence by creating an 11.5 x 29 px rectangle (#6ebea2) for the post, giving it a shadow followed by a 4 px thick outline (#3d342d). Group (Control-G) all the parts together and place one copy of the post on the top of the slope. 

Building a Small Rectangle

Step 7

Select the original post, open the Move option window (Enter), and set the horizontal value to 65 px. Click on the Copy, getting a duplicate of the post on the right side. Keeping the duplicate selected, press Control-D two more times, getting two more copies.

Group (Control-G) all four posts together and rotate the group by 30 degrees using the Rotate tool (R).

Attach the post group to the left edge of the slope.

Working over Fence Racks

Step 8

Now we need a rail sitting over the posts.

Copy the slope’s black outline and drag it onto the side row of posts, making its left edge sit on their top as shown in the image below.

Delete the right and bottom edges of the outline.

Drag its end points with the Direct Selection Tool (A), placing one of them on the left edge of the cabin and another on the top-left anchor of the left post. Set Round Cap for the rail.

Forming a Crossbar

Step 9

Doing the same manipulations, copying and dragging the posts and the rail, create another fence on the right side of the tower.

Finishing the Fence

Step 10

Let’s create bearing piles supporting our cabin.

Build a 14 x 113 px rectangle (#48a987) on the right side below the cabin. Give it a shadow followed by a 6 px thick outline (#3d342d).

Group (Control-G) all the parts together and make a duplicate on the left.

Making Supporting Piles

Step 11

Draw two 6 px thick horizontal lines (#3d342d) going from one pile to another, making the left endpoints slightly overlap the left post.

Group (Control-G) the bearing piles construction and create a copy, moving it to the left and hiding it behind the tower, as well as making the color darker.

Building Bearing Piles Group

4. How to Make a Windsock and Add Details

Step 1

Let’s add a flowing windsock on the roof of our beach tower.

Form a 62 x 24 px rectangle (#d65428) for the main windsock shape.

Then add one anchor point on the middle of the right edge with the Add Anchor Point Tool (+). Delete the top and bottom anchors, getting a triangle, and make its right corner rounded by pulling the Live Corner indicator to the center with the Direct Selection Tool (A).

Add a 15.5 x 24 px ellipse (#a8411f) on the left part of the triangle.

Creating a Red Cone

Step 2

Select the ellipse and go to Object > Path > Offset Path. Enter 10 px into the Offset value field and press OK, getting an outline.

Keeping the outer ellipse selected, use the Offset Path again, setting the Offset value to 5 px.

Select both outer shapes and go to Object > Path > Offset Path again. Set the Offset to 20 px, getting two more outer shapes.

Select the cone shape, get one copy in the front, and select the copy together with the four outer ellipses using the Divide option of the Pathfinder panel.

Delete all divided pieces except the two stripes, changing their color to #fbf8f1.

Building Stripes on the Cone

Step 3

Give the shape that we’ve just created a highlight followed by a 4 px thick outline (#3d342d) with a Round Join. Add the same outline to the ellipse.

Create two ropes attaching our windsock to the pole. Use two 4 px thick lines for the ropes and a 6 px thick line for the pole.

Group (Control-G) all the sock parts together and position it on the roof of the tower.

Finishing Off the Red Windsock

Step 4

We are nearly done with the beach guard tower.

Give our tower a more interesting and stylish look by opening some of the outlines. To do it, just use the Add Anchor Point Tool (+) to add additional anchors on the outlines and then Delete paths between these anchors, making sure to set the Cap of the remaining outlines to Round from within the Stroke panel.

Take your time, and once you’re done, add some additional 4 px thick lines near the edges of our illustration.

Finish the tower by adding a few lines below for the ground level.

Opening the Outlines

5. How to Create a Tropical Beach Background

Let’s place our beach guard tower on a tropical paradise by creating a seaside landscape on the background.

Step 1

Form a 1200 x 1200 px rectangle (#fb9f31) behind our building for the background.

Add a few 6 px thick lines of #f8cc6b color below the tower to imitate the surface of water. Make them more interesting and lively by adding some dashes and varying their sizes.

Forming a Background and Surf

Step 2 

Add a 300 x 300 px circle (#f37f10) for the setting sun and two outer circles for the sun’s glow. Use white color and Screen Blending mode with 30% Opacity for the glow.

Delete the outstanding lower part of the outer circle by selecting it and Alt-dragging over the outstanding part with the Eraser Tool (Shift-E).

Creating a Sun

Step 3

We need a few additional elements to finish the composition.

Create a simple palm made from a few leaves and a rectangular trunk. We can get a leaf by using the Intersect option of the Pathfinder panel for two overlapping ellipses. Then attach a rectangle for the trunk and form a crown by copying and moving the leaves. Use #f37f10 for the color.

Then make a cloud consisting of overlapping circles and a rounded rectangle. Just remove any unwanted pieces with the help of the Shape Builder Tool (Shift-M), merge all shapes into one with the Unite option of Pathfinder, and set the color to #fbe2aa.

Spread the palms and clouds over the scene, creating a balanced composition.

Adding Smaller Details

That’s It! Our Beach Guard Tower Illustration Is Ready

Congratulations! Our flat-style Baywatch house scene is finished.

I decided to add two seagull silhouettes on the background to enhance the atmosphere of the seaside sunset. Can you now feel the summer breeze and the sea surf splashing on a tropical coast? Our lesson is ending here, and new adventures are beginning.

I hope you enjoyed the process and discovered something new and helpful along the way.

This beach guard tower illustration is only a part of my Summer Seaside collection, and there are far more travel and adventure illustrations in my portfolio on GraphicRiver.

Sea Side Collection on Graphicriver

10 awesome examples of stamps used for graphic design

Post pobrano z: 10 awesome examples of stamps used for graphic design

Thinking of using stamps in one of your upcoming design projects? This may be a good idea, especially if you use the stamps as well as these following examples.

1. CD packaging for Geir Strandenæs Larsen

A seal imagined by Daniel Brokstad to add a nice touch to the package.

2. DIY Hand Stamped Wooden Business Cards

How do you print on wooden business cards? Easy, you use a stamp like Hans Thiessen did.

3. Curry Up

On top of having a cool business name, Curry Up had a good idea to hire Design Wombs for their rebranding. The use of stamps was a great idea too.

4. Identity for Dylan Culhane

Who said stamps always needed to be used with ink? Stamp relief itself looks good enough to add a touch of class. Take a look for yourself on this amazing identity design.

5. Business cards for The Awesome Project

When you name your design studio The Awesome Project, it makes sense that you create awesome business cards, which they did.

6. Chez Faucher business cards

Gorgeous business cards and identity design for this online store, more about the project.

7. Japanese stamps for packaging

Stamps play an important in visual arts in East Asia, this packaging design is a great tribute to this traditional art form.

8. Vic stationery

The use of stamps adds a warm feeling and a real human touch. Great work by KMG.

9. Café Chiquilin

For Café Chiquilin’s corporate identity, larger chunks of texts have been included using stamps, and it works very well.

10. Privilege

A golden stamp that looks just perfect for this Dubai company that sells luxury goods.

Clearfix: A Lesson in Web Development Evolution

Post pobrano z: Clearfix: A Lesson in Web Development Evolution

The web community has, for the most part, been a spectacularly open place. As such, a lot of the best development techniques happen right out in the open, on blogs and in forums, evolving as they’re passed around and improved. I thought it might be fun (and fascinating) to actually follow this creative exchange all the way through. To take a look at a popular CSS trick, the clearfix, and find out exactly how a web design technique comes to be.

The clearfix, for those unaware, is a CSS hack that solves a persistent bug that occurs when two floated elements are stacked next to each other. When elements are aligned this way, the parent container ends up with a height of 0, and it can easily wreak havoc on a layout. All you might be trying to do is position a sidebar to the left of your main content block, but the result would be two elements that overlap and collapse on each other. To complicate things further, the bug is inconsistent across browsers. The clearfix was invented to solve all that.

An early illustration of the issue from Position is Everything

But to understand the clearfix, you have to go back even further, to the 2004 and a particular technique called the Holly hack.

2004: The Holly Hack and the origin of Clearfix

The Holly hack is named for its creator, Holly Begevin, a developer and blogger at CommunityMX. The Holly hack combines two different CSS techniques that worked in the days of Netscape Navigator and Internet Explorer (IE) 4 to solve some layout issues. Begevin noticed that if you apply a height of just 1% to each of the floated elements in the above scenario, the problem would actually fix itself (and only because it activated an entirely different bug) in Internet Explorer for Windows.

Unfortunately, the 1% trick didn’t work on a Mac. For that, Begevin added a conditional comment which used a backslash inside of her CSS, which strangely enough, blocked individual CSS rules from IE for Mac in the old days. The result was a CSS trick that looked like this:

/* Hides from IE5-mac \*/
* html .buggybox {height: 1%;}
/* End hide from IE5-mac */

Odd, I know, but it only gets more complicated.

That same year, in May, there were a few more browsers to deal with, and not all of them could be patched with one line of CSS. Tony Aslett posted a new thread to his message board, CSS Creator, proposing a new approach. He called the trick a clearfix because it centered around clearing the floated elements to fix the issue.

Aslett’s approach took advantage of what were, at the time, still very new CSS pseudo-selectors (specifically :after) to automatically clear out two floated elements. There was one pretty massive drawback in Aslett’s first version of the clearfix. Having never heard of the Holly Hack, Aslett’s code required a bit of JavaScript to fix issues that were specifically popping up on IE for Mac. In those days, JavaScript was a relatively untested technology, and relying on it in such a fundamental way was less than ideal.

Thankfully, the web is a place of iteration, and one message board user pointed Aslett in the direction of the aforementioned Holly Hack. By sprinkling in Begevin’s conditional comment, Aslett was able to make his code work in just about every browser with no JavaScript at all.

.floatcontainer:after {
  content: "."; 
  display: block; 
  height: 0; 
  clear: both; 
  visibility: hidden;
}

/* Mark Hadley's fix for IE Mac */     
.floatcontainer {
  display: inline-block;
}

/* Hides from IE Mac \*/
* html .floatcontainer {height: 1%;}
.floatcontainer{display:block;}
/* End Hack */

If you want to pick apart an important slice of web history and innovation, the discussion that followed Aslett’s post about clearfix is a great place to start. One by one, people began to experiment with the new technique, testing it in obscure browsers and devices. When they were done, they’d post their results to the message thread, sometimes alongside a helpful tweak.

For example, the user zulaica pointed out that in Mozilla browsers, the bottom border of floated elements had to be explicitly defined. User pepejeria noticed that you could leave out the dot from content, and user co2 tested the clearfix in the very first version of Apple’s Safari browser. Each time, Aslett would update his code a bit until, after more than a few rapid iterations, the clearfix was ready and, thanks to the community, pretty darn bulletproof.

2006: Clearfix gets an update

But browsers kept on advancing. Some of the more quirky bits of the clearfix code worked because of bugs that were built into older browsers. As browsers patched those bugs, in brand new versions, the clearfix stopped working. When IE 7 came out at the end of 2006, a few adjustments to the technique were needed to make it work.

Fortunately, John “Big John” Gallant was maintaining a page on his blog Position is Everything with an up to date version of the clearfix. After getting some feedback from his readers, Gallant updated his blog to reflect a few new fixes for IE 7 using a new kind of conditional comment that would work inside of Internet Explorer.

<style type="text/css">

  .clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
  }

</style><!-- main stylesheet ends, CC with new stylesheet below... -->

<!--[if IE]>
<style type="text/css">
  .clearfix {
    zoom: 1;     /* triggers hasLayout */
  }  /* Only IE can see inside the conditional comment
    and read this CSS rule. Don't ever use a normal HTML
    comment inside the CC or it will close prematurely. */
</style>
<![endif]-->

And once again, users took to their own browsers to test out the latest code to ensure it worked everywhere. And once again, for a time, it did.

2010: Clearfix Reloaded

In fact, this iteration of the clearfix would last until about 2010, when the team at the Yahoo! User Interface Library (YUI) noticed a few issues with the clearfix. The Holly Hack, for instance, was now long gone (IE 5 was but a distance memory), and after switching the box model, margins were handled a bit differently by modern browsers.

But the folks at YUI still needed to line up one element next to another. In fact, the need had only increased, as designers experimented with more advanced grid layouts. In 2010, there were very little options for grid layout, so clearfix had to work. They eventually came up with a few additional tweaks to the CSS ruleset, most notably by taking of advantage of both available pseudo-selectors (:before and :after), to clear out any margins. They posted their new take to their own blog and called it “clearfix reloaded.”

.clearfix:before,
.clearfix:after {
  content: ".";    
  display: block;    
  height: 0;    
  overflow: hidden;        
}
.clearfix:after { clear: both; }
.clearfix { zoom: 1 ;} /* IE < 8 */

2011: The Micro Clearfix

But even when it was published in 2010, clearfix reloaded brought with it some unnecessary baggage from older browsers. The height equals 0 trick wasn’t really a requirement anymore, and in fact, the trick was a lot more reliable when display: table was used instead. People began swapping various variations on the technique on Twitter and on blogs. About a year after the release of clearfix reloaded, developer Nicolas Gallagher compiled these variations into a much more compact version of the hack, which he appropriately labeled the micro clearfix.

After years of back and forth and slight adjustments, the clear fix now required just four CSS rules:

/*
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *  contenteditable attribute is included anywhere else in the document.
 *  Otherwise it causes space to appear at the top and bottom of elements
 *  that are clearfixed.
 * 2. The use of `table` rather than `block` is only necessary if using
 * `:before` to contain the top-margins of child elements.
 */
.cf:before,
.cf:after {
  content: " "; /* 1 */
  display: table; /* 2 */
}

.cf:after {
  clear: both;
}

/*
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */
.cf {
  zoom: 1;
}

The End of Clearfix?

These days, almost 15 years after it was first proposed, the clearfix is losing a bit of relevance. CSS Grid and Flexbox are filling in the gaps for advanced layout on the web. In January of 2017, Rachel Andrew wrote an article for her blog titled „The end of the clearfix hack?” In it, she describes a way to replace the clearfix hack with a single line of code using a new display mode rule known as flow-root.

.container {
  display: flow-root;
}

We are approaching the day when clearfix will no longer be necessary at all.

Even without flow-root, there’s lots of ways to make a grid these days. If you were just starting out on the web, there’d be little reason to even learn about it. That’s a good thing! From the beginning it was always meant as a workaround to make the best of what was available. The irony being that without the dedication and experimentation of the developers who hacked away on the clearfix for so many years, we wouldn’t have the tools today to never have to rely on it again.

Enjoy learning about web history with stories just like this? Jay Hoffmann has a weekly newsletter called The History of the Web you can sign up for here.

The post Clearfix: A Lesson in Web Development Evolution appeared first on CSS-Tricks.

Agregator najlepszych postów o designie, webdesignie, cssie i Internecie