CSS & HTML

5 Simple but Useful CSS Properties Every Designer Should Know

By Aigars Silkalns Updated 6 min read

The five CSS properties worth knowing well today are aspect-ratio, gap, clamp(), accent-color and text-wrap: balance. Each one replaces a hack you probably still have in an old stylesheet: padding-percentage boxes, margin tricks on every child, media-query font ladders, custom-drawn checkboxes and manual line breaks in headings.

The first edition of this article, from 2009, picked five old CSS 2 properties: clip, min-height, white-space, cursor and display. Those still work (and clip has since been replaced by clip-path), but the useful, underused properties are now newer ones. Here is the updated list, with code you can paste.

A card grid showing aspect-ratio boxes, a flex gap of tags, fluid clamp() text, tinted form controls and a balanced heading
The demo page behind the snippets below: aspect-ratio boxes of equal height, a wrapping flex gap and clamp() text. The tinted controls, :has() card and balanced headings appear further down.

1. aspect-ratio: stop faking proportions with padding

The old trick for a 16:9 box was a wrapper with padding-top: 56.25% and an absolutely positioned child. aspect-ratio does it in one line. Give an element a width and it works out the height.

.thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* crop to fill, never stretch */
}

.avatar {
  aspect-ratio: 1; /* a square from the width alone */
  border-radius: 50%;
}

This replaces the image-cropping job that clip: rect() did in the original article. Set the ratio on the box and let object-fit: cover crop the picture, which is exactly the square-thumbnail gallery from 2009 in three lines. It also prevents layout shift: for an <img>, the browser derives a default ratio from its width and height attributes, so keep those attributes in your markup.

One gotcha: aspect-ratio only applies when one dimension is automatic. In a flex row, items stretch to the row height by default, which overrides the ratio. Add align-items: start (or align-self) when a ratio looks ignored. It is Baseline widely available.

2. gap: spacing without margin hacks

We used to space a row of items with margin-right and then undo the last one with :last-child. gap spaces only the space between items, in grid and in flexbox.

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px; /* row-gap column-gap */
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

When the tags wrap onto a second line, the row gap applies automatically and nothing needs resetting. This is the property that finally made flexbox lists painless. If you want to see flexbox in depth, read Master CSS Flexbox in 5 Simple Steps. gap is Baseline widely available for both layout modes.

If you still support very old browsers, keep a margin fallback and let gap win where it works: put margin: 0 10px 8px 0 on the items, then add @supports (gap: 1px) { .tags { gap: 8px 10px; } .tags > * { margin: 0; } }. Almost no project needs this today, but it explains why old code carries both. Never apply both at once, or the spacing doubles.

3. clamp(): fluid sizes with built-in limits

clamp(min, preferred, max) picks the preferred value but never lets it go below the minimum or above the maximum. It is the cleanest way to make type and spacing fluid without a pile of breakpoints.

h1 {
  font-size: clamp(1.25rem, 0.9rem + 1.6vw, 2rem);
}

.section {
  padding-block: clamp(2rem, 6vw, 5rem);
}

.container {
  width: clamp(20rem, 90%, 72rem);
  margin-inline: auto;
}
Demo cards showing a clamp() heading with its minimum and maximum widths, tinted form controls, a :has() two-column card and balanced versus default headings
The clamp() card states its range: the heading stays at 20px below a 350px viewport and stops growing at 32px from 1100px.

Notice the preferred value mixes rem and vw. Pure vw text ignores the user’s font-size setting and can fail zoom accessibility checks, so always add a rem part. To test it, set the browser zoom to 200 percent and check that headings still grow and nothing overflows: text with a rem floor scales with zoom, while text sized only in vw does not. This property pairs well with the ideas in 5 Useful CSS Tricks for Responsive Design and Setting Breakpoints in Responsive Design. It is Baseline widely available.

4. accent-color: brand your form controls in one line

Custom checkboxes used to mean hiding the real input and drawing a replacement, which usually broke keyboard and screen reader behavior. accent-color tints the native control instead, so you keep every built-in behavior.

:root {
  accent-color: #4f46e5;
}

progress {
  accent-color: #10b981; /* override per control */
}

MDN lists it as affecting checkboxes, radio buttons, range sliders and <progress>. Because the property is inherited, setting it on :root brands every supported control on the page. It shipped in Chrome and Edge 93 and Firefox 92. Safari has tinted checkboxes and radios since 15.4 but only gained full support in 26.2, so MDN still lists it as not Baseline, and the fallback is simply the default control, which is still fully usable. Pick a color with enough contrast against the control’s background: Safari before 26.2 does not enforce minimum contrast for you, and in any browser the control is drawn for you, so you cannot fix a weak choice afterwards. Check the checked state at both light and dark themes. For fully styled forms, see the snippet Contact Form with Topic Chips and Checkboxes.

5. text-wrap: balance: headings without orphans

A heading that wraps often leaves one short word on the last line. We used to insert <br> or &nbsp; by hand, which breaks as soon as the viewport changes. text-wrap: balance asks the browser to even out line lengths.

h1, h2, h3, blockquote, figcaption {
  text-wrap: balance;
}

p {
  text-wrap: pretty; /* avoids orphans in body text */
}

text-wrap: balance and pretty have different support. balance shipped in Chrome and Edge 114, Firefox 121 and Safari 17.5, and MDN marks text-wrap-style as Baseline newly available (since 2024), so it is safe as an enhancement for headings. pretty is newer: it works in Chromium and Safari 26 but not yet in Firefox, and its behavior is more uneven between engines. Balancing is deliberately limited to short blocks: Chromium balances up to six lines and Firefox up to ten, after which text wraps normally. That makes it a heading and caption tool, not something to apply to articles. Use pretty only as a bonus on body copy, and check it where you ship.

Bonus: the old five, and :has()

The 2009 properties are still handy, with updates. Use min-height with dvh units for full-screen sections (see CSS Fix for iOS vh-unit Bug). white-space: nowrap still keeps short labels together. Use cursor: pointer sparingly, and note that cursor: not-allowed is the usual signal for a disabled control. Replace clip with clip-path or object-fit.

If you want one more property-sized upgrade, learn the :has() selector. It lets a parent react to its children, for example .card:has(img) { grid-template-columns: 1fr 2fr; }, something that needed JavaScript for years. We ran that exact rule in the demo above: a card containing an image switches to two columns and a card without one stays single-column. :has() is Baseline widely available (Chrome and Edge 105, Safari 15.4, Firefox 121). Our guide to the power of CSS selectors covers the selector family it belongs to.

How to adopt them without breaking anything

You do not need a rewrite. Start in the places where the old hack hurts most, and work outward.

  1. Search your stylesheet for padding-top percentages such as 56.25% or 75% and replace each wrapper with aspect-ratio.
  2. Find every :last-child { margin: 0 } reset. Delete it and move the spacing to gap on the parent.
  3. Replace font-size media queries with one clamp() per heading level, then test at 200 percent browser zoom.
  4. Set accent-color once on :root and remove custom checkbox code that does not add real design value.
  5. Add text-wrap: balance to your heading selector and delete manual <br> tags inside titles.

Each step is independent, each one deletes code instead of adding it, and each degrades gracefully: a browser that ignores a declaration falls back to ordinary behavior, so the page stays usable.

Quick reference

Property Replaces Best for
aspect-ratio Padding-percentage wrappers Thumbnails, video, avatars
gap Margins plus :last-child resets Flex and grid spacing
clamp() Media-query font and spacing steps Fluid type, padding, widths
accent-color Hidden inputs with custom drawings Checkboxes, radios, sliders
text-wrap: balance Manual line breaks Headings, captions, quotes
119 comments from the archive
  1. These are really useful. I was actually working on my post with same CSS properties. Too bad you beat me! Always good post Nick. Top of the line

  2. Thanks for this useful review, and I didn’t know about “clip”. This is awesome CSS trick, I wish I knew it before. Does it work on all browsers? (IE6??)

  3. I’ve never heard of the white-space CSS rule before. i’m going to have to look into that because it seems like a useful rule.

    That’s the new thing I learned today, so thank you for that!

  4. Great Post. I wish people would migrate away from IE6. There are so many unnecessary properties you have to add.

  5. I already knew cursor, min height and display, but I never have heard about white space and clip!! Thank you, they are very interesting and useful!

  6. Really useful post. Never heard of the clip attribute, really wishing I had.

    The only issue I have is #5, why not use / float: left / and maintain the ability to set width/height, among other attributes? / display: inline / is a rather harsh way of going about it.

  7. Wonderful post as always! It’s so easy to forget about these hidden gems when you’re eyeball deep in CSS.

  8. Thankyou for this, I found it really useful, especially the clipping information. I’ve wanted to do something like this, didn’t realise this existed!

    And, I think I’ll tidy up my portfolio by using inline elements instead if floating block elements!

  9. Funny, but after 6 years of coding CSS professionally, I haven’t heard of CLIP and there were several times when I needed it.

  10. I didn’t know much about clip property and your article showed me a very well example.

    Thanks in advance.

  11. Never heard of clip attribute and I have 3 years experience is CSS now.
    White-space it is a great function also!

  12. For the final properly, inline-block will be a great substitute but it’s a shame that it’s not interpreted as we wanted it to be in Internet Explorer (not that I’m complaning, since it has been like that all the time).

    I’ve been using white-space property for my <pre> and <code> tags, but I never knew the no-wrap properly could prevent breaking of certain phrases/statements (e.g. dates in your example) into a new line midway. That’s a really excellent application for white-space. Two thumbs up for that!

  13. The only one I haven’t used is clip and I cant believe why not, these are some amazingly powerful commands for use with styling websites.

  14. LOL using css for years yet I didn’t even know there is a “white-space”! thx for sharing !

  15. Great tips especially about clip property I have never used it before, I always use background property and shift the image. Also thanks for the cursor tip I just found a fix for my site.

  16. Thanks for the visual on the clip property. Though, I do use the display property quite a bit.

  17. Thanks for the tips! I’ve never seen the clip property before. I’m sure I’ll use it now though!

  18. It’s definitely worth noting that min-height only works if the parent element has either a height or a min-height defined, so at the very least, your body will need to have a height defined even if it’s 100%.

  19. Never heard of “clip” CSS2 property. Hmmmm…

    I guess it wasn’t used much by Web designers (a few years ago, I used to study other designers’ code quite often, to learn how they do design/code) at the time I was starting to learn CSS (a few years ago).

    Thanks for sharing! :-)

  20. Do you declare the height twice to override the the !important in IE6?

  21. I’d recommend against using the !important hack for IE6. Why penalize other browers when it’s IE that you’re targeting? “!important” means that it will be that more difficult for assistive devices or end-users to override the “height:auto” value if they ever need to.

    A better solution for targeting IE and handing it just the value that’s needed?:

    Use * html .with_minheight { height: 500px; } to target just IE6. It’s validating CSS and only targets our problem browser.
    Use a conditional commented stylesheet to target IE6 only. Again, just targeting IE6 and not introducing cruft to other browsers.
    Or simply just use the underscore hack on the height to target only IE6: .with_minheight {
    min-height:550px;
    _height:550px;
    } Technically, this is valid CSS markup, but it won’t pass validators (see w3c recommendation on css browser-extensions). Again, only targets IE6. No cruft added to other browsers.

  22. Hmm. Unfortunately, your system allowed me to add UL and LIs and PRE tags and showed them just fine in the preview, but then ate them on publish. You should fix that. Don’t show me the preview if it won’t take.

    Cheers.

  23. great stuff, have been using some of these like min-height,display-inline, cursors for a while now, but it is always great to know about different things.

  24. Hey thanks for this article. I had now idea about CLIP: in css. Now i come to know what is it all about :) thanks

  25. Wow nice tips especially the CSS clip. I don’t even know it exist. Thanks!

  26. Like several others I hadn’t really come across the clip property … thanks for that.

    Just a thought … might be good to run down exact browser support for properties such as the clip, so that the visitor doesn’t have to track it down themselves … a ‘nice to have’ ….

  27. I find the clip property very useful, but its poor support in IE6 make it another candy feature we cant apply in order to keep our sites accesible to -still- many- users. If you want more info about this lack of support, here is an interesting post

  28. i am found here what the meaning all about form that script….ihihihihihi….usefull

  29. Thanks for the info on CLIP – like almost everyone else here, I didn’t even know it existed! Extremely useful!

  30. I’ve never come across these CSS properties but they look like they would be useful for me and I will have to try them on my new websites. Thanks for sharing this.

  31. With all the talk lately about CSS3, it’s refreshing to see someone exploring the depths of the CSS2 standard we’re using now. This post reminds me of “HTML Mastery” – it’s information that a lot of designers will “know” in the back of their head somewhere, but you’ve brought it out into the light to tell people “these properties exist for a reason.” Thanks for the info!

  32. I had no clue about CSS Clip. I think I will definitely be using that in the near future. Thanks

  33. Whitespace is a nifty trick to have. I can’t say how many times I’ve had edits to a page that involve forced line breaks because the content flows into email or web page templates differently, depending on how the font size is rendered in different programs.

  34. I wasn’t familiar with CSS Clip either. I’ve been testing it and it’s cool.
    Thanks for the tip Nick ;D

  35. Quite interesting and simple CSS properties and quite well explained too.
    Thanks a ton.

  36. Clip property is really helpful for me, will use it in future work.
    Thanks alot!!!

  37. Great stuff Nick, very useful to get reminded of old forgotten tricks and some brand new ones I had no idea about.

    The clip property is a great resource to have, I´m kind of looking forward to using it :)

    From w3cshool:
    Note: No versions of Internet Explorer (including IE8) support the property value “inherit”.

    …guess the old bastard (ie) does support everything but the inherit, kudos to microsoft.

  38. cool.. thank you for this – the min-height one was always a challenge for me. Now you cleared it up.

  39. I never knew there was a way around the automatic new line break of divs, p, and heading tags. Inline and block is what i’ll be using. Thanks so much!

  40. You can use urls for cursor like:

    cursor: url('../img/cursors/hand.png'), pointer;

  41. Thanks for the short and concise info. White Space and Min Height will come in handy.

  42. Thanks for taking the time to share your knowledge with us. I’m a newbie and didn’t know about these properties. I can already see where I can benefit from a few of them immediately. THANKS!

  43. I can’t believe this post has so many comments. All of these properties I already knew about except for the CSS clip properly. Thanks for going so in depth with each one.

  44. Great tips for the green and refreshing for the busy…

    As some of us have to wear many hats on a job this was a good find
    to kick start my brain as an individual many things get buried in the mental Rolodex anyone who knows every property all the time must not do much else but css & html (No offense intended).

    So I do find snarky comments a tad “fan-boyish” the “gaw an idiot should know this” types don’t comment with out good reason it makes you look like a “enter foul language”. Sorry for treading Nick.

    Thanks.

  45. Whilst I’ve heard of all these properties other than clip I’ve never once come across a guide on how to use them. Thank you Nick, now I properly understand what each of these properties do!

  46. I found the clip to be especially interesting–something I hadn’t really heard of. I think it can be applied very effectivily in interactive slideshow to see more detail.

    Thank you for the post–def. Useful.

  47. Hi there, I would love to have a comment box like this, may I know how do i get it? It’s for my blog :)

  48. Great to see a post called 5 simple CSS and useful properties. This is a far cry from Smashing Magazines usual top 50 etc, etc which take a while to read and I doubt if any website designer has the time to read through 50+.

    So well done Designer Wall, great and simple tips regarding CSS properties.

  49. Thanks, Nick; I didn’t know about the clip property at all, and some of these I wasn’t sure how to properly use them or what their actual purpose even was. I can’t wait until the next time I want to put text next to a heading — I now have the power of inline!

  50. thanks a lot for the clip property. it was in my to-explore list but had forgotten to search it… i don’t think i would’ve found better article elsewhere. keep blogging.. :)

  51. I like the min-height, In fact, I didn’t know you can do this, can you do this to set 100% so you have a faux fake columns effect?

    thanks

  52. Another useful post .. :)

    Thanks for the min-height hack for IE 6.

    enjoy :)

  53. I can’t wait until the next time I want to put text next to a heading — I now have the power of inline!

  54. But clip() values should be separated by commas, not only spaces, right? To validate, I mean.

  55. As usual you answer all the questions in web design that I diddn’t even know I was asking.

  56. very cool thank you! Will definately use the min-height one for a twitter box I have.

  57. Great post! I use most of these all the time (especially white-space and display, and to a lesser extent cursor) but I didn’t even know clip existed… now I just need to find a situation where I can justify using it. Hmm…

    The min-height hack for IE6 is another great tip. I hadn’t thought of that… and I usually just avoid using min-height because of IE6.

  58. wow! great tips, i like it. how about browser? is supported by all browser?

  59. Gr8 Post !!!!!!
    Can u guide me, how we can center and middle align the whole template or an image in div as we use in tables??????? Tell about the problem we face on that in different browsers……..:) Thanks

  60. Great post friend!!

    I was drooling for past few days for min-height compatibility with IE 6.
    Finally got a solution.
    Thanks :)

  61. I use min-height quite a lot with my designs and so was surprised to read you say that it was widely supported yet rarely used. This attribute is incredibly useful if you’re looking to create multi-column fluid layouts. Giving each column a min-height ensures the columns are displayed with a uniform height.

    The cursor attribute is indeed one I rarely use and I think you’ve inspired me to play about with them now. Thank you for posting. It was great to read.

  62. Great post. There is so much you can do with CSS, I’m so glad CSS is widely accepted and is the future of layout. Now if we could get all the browsers to agree everything would be bliss. I didn’t even know about this clip property. Thanks for the schooling.

  63. The min-height property is very useful, I was struggling with an issue like your (keeping a column larger than another) and used a very complicated way to achieve this. The min height is so much easier, and the IE hack makes it virtually perfect. Thanks for this.

  64. Very very useful topic for all the designers, now i understand what is the importance of clip attribute in css, i have one more request please also explain the other attribute which is generally not used by the css/ html coder

  65. Execelente, hace varios meses que estaba buscando trucos como estos, gracias!

  66. Thanks, Nice little set of tips.
    Another one not many people know about is {text-transform: uppercase;} for capitalized text !
    Merry xmas

  67. I just recently used cursor to great effect on a css styled form button. Great stuff!

  68. Very helpful tips! The Min-Height style is awesome – will definitely use that one a lot. Thank You!

  69. WOWWW I love your site and the helpful material. I’ll definitely be back; I’m trying to create my own WordPress theme instead of just modifying ones I get.

  70. This are very helpful tips. I just made 5 simple CSS websites wondering how to lengthen the height of the content area just past the sidebar without adding extra nonsense content. I even visited your site but how I wish I saw this post earlier.

    But thanks, I’ll be using this tips if ever I’ll be making some again in the future.

  71. How much I say you thanks, really great material. Every day visit few dozens of websites.I can say Best CSS tutorial on web.

  72. hey, nice post about CSS properties. I learned something new. Great work and nice design of your site.

  73. Hey,about the clip property, why you don’t use overflow:hidden for li ,i think it more simple to use clip property

  74. Thanks nice list.. But min-height is not supported by IE6 .. How do i tackle this? :(

  75. Some really useful tips here especially like the css clip one as ive always wondered how to do that. Im thinking that you could use the css display:inline-block to get the same results for the last one thou.

  76. Stumble Upon brought me here.
    I’ve been having a problem with my livejournal layout covering itself on short pages and haven’t gotten around to fixing it until just now with the Min-height.
    Stumble got my work back on track. Whatever is the world coming to!?

    Thanks for the tips.

  77. AMASING, very usefull post! thanks, i just didn’t understand the white space, i think that more exemples could be better, thanks!!

  78. Great article, I didn’t know these properties…. but than again, I am quite the newbie… thanks for sharing ;-)
    Cool design of your blog BTW – thumbs up!

  79. Hi,

    I tried to change the position of this image stting: top to 0 and left to 0. but it didn’t work.

    Do you know how i can proceed?

  80. Thoughts Hosting:- Domain Name Rs.92/-only, 10Gb space, 100 Email id’s, Rs.2600/-only. And for every domain get FREE extras over 7900/-. *Start Your Own Web Hosting Company Only for Rs.4000/-. visit: http://www.thoughtshosting.com, Contact:9059747833

  81. I am working on CSS .And this article will help me a lot.I request to you please share some more tips.
    Thank you.

  82. Good post, I just hope that the resizing of the image is not mistaken by some as resampling. Hence, one of the effects is that the file size remains the same after manipulating the dimensions. So, please advise them to use it wisely.

  83. How would you do the image resize and clip with a combination of portret and landscape images?

  84. Pretty interesting properties. For the “min-height” I simply used padding (but then the effect is a bit different and not as neat). I appreciate the heads up about these properties! :)

  85. Hello, I think #3 is wrong. I believe setting the white-space to nowrap would keep it all on one line. Thus, not wrapping as the value suggests.

  86. For display I think you missed out 2 values which are ery useful: ‘none’ and ‘inline-block’. None hides the element and is very useful with Javascript etc. and inline-block allows you to use some of the characteristics of a block elements (height, top and bottom padding etc.) on inline elements.

  87. interesting about the css clip… never used it.

    Would the images still be the same size and take the same amount of time to load on the page? Why not just crop in PS to cut down on page load times?

  88. Yay! Thanks for these tips! very useful. I already knew ‘cursor’ and ‘min-height’, but they are not very common properties. By the way, I love this site :D

  89. Thanks for sharing these css properties. Can you display which browsers support which properties. I know there are some issues with white-space.

  90. Hi, i like your articles, very usefull. Can you tell me is it hard to make language-selection menu on CSS? cant find it by Google )

  91. I get what the clip thing does but I’m not sure where I might need it?

    Thanks

  92. Thank you for this nice tutorial, hope you show us more about css properties.

  93. Though white iphone 4 is at high price, but with all-powerful function, we can see lots of people just crazy for the latest white iphone 4.

  94. White iphone 4 avaiable! It’s a great news to tell you the latest white iphone 4 Conversion Kit is on sale. Get the chance to make your iphone more charming!

  95. If I got a chance, i will prefer buying the iphone 4 white but not the iphone 4 Black. Who can tell me where is the Best iPhone Cases I would really want to take one. Best iPhone Cases and Covers, Sale iPhone 4 Cases, iPhone 3g Cases and Accessories

  96. The Image Resize and Clip demo cleared my confusion. Thank you.

  97. You have unique business goals and you need someone to make the vision of small businesses in real presence on the Internet. Availability of new, professional, custom designed web site will help increase sales and expose you to thousands of new customers.

    Web Application Design

  98. World most wanted Tutorials Listing! A huge collection of tutorial you are invited!!

  99. Thank you for the resources. I can use some of these css to my own site.

Comments are closed on this article.