TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Collection of Useful CSS Snippets

353 pointsby marinacaladoover 7 years ago

18 comments

drinchevover 7 years ago
Most of them are oldies, but &gt;goldies&lt;.<p>Tooltips are my favourite CSS-&quot;trick&quot;. I&#x27;ve seen countless developers implement those with javascript, which is redundant if you know proper css selectors.<p>On the other hand I don&#x27;t find myself using the clearfix ( actually I ditched floats for layouts, long time ago ), css triangles ( usually some unicode arrow or an image ), gradients &#x2F; animations and shadows are out of the current trend ( everything is flat &#x2F; material these days ).
评论 #16474537 未加载
评论 #16473653 未加载
评论 #16473855 未加载
评论 #16477276 未加载
评论 #16478433 未加载
评论 #16480243 未加载
degenerateover 7 years ago
FYI for &quot;System Font Stack&quot; - There is no &quot;-windows-system&quot; CSS declaration, so this is why the list of fonts is long... it includes each windows font. More is explained here, as well as an alternative way to load the fonts using @font-face:<p><a href="https:&#x2F;&#x2F;css-tricks.com&#x2F;snippets&#x2F;css&#x2F;system-font-stack&#x2F;" rel="nofollow">https:&#x2F;&#x2F;css-tricks.com&#x2F;snippets&#x2F;css&#x2F;system-font-stack&#x2F;</a>
评论 #16477715 未加载
ibudialloover 7 years ago
Recently I was wondering how they created that click animation in material design. So i made my own and you can check the code here <a href="https:&#x2F;&#x2F;github.com&#x2F;ibudiallo&#x2F;buttons" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ibudiallo&#x2F;buttons</a><p>Note that it works without js, but js allows to position the button press effect right under the mouse.
nukeopover 7 years ago
On one hand, great, useful, and very pretty. On the other hand this reinforces the use of such antiquated and hacky concepts as clearfixes, or floats for layout.<p>Also, the ellipsis truncation is very tricky to pull off. The parent element needs to be a block if I remember correctly.
atmartinsover 7 years ago
Truncate text has a huge caveat in that it doesn&#x27;t work fully for multi line text.
评论 #16477520 未加载
Sukottoabout 7 years ago
As an aside. I recently found <a href="https:&#x2F;&#x2F;www.caniuse.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.caniuse.com&#x2F;</a> and find it super helpful as I get back into frontend development.<p>It gives you a clear picture of how well the different browsers support a given piece of web technology.
lytedevover 7 years ago
The pretty text underline (<a href="https:&#x2F;&#x2F;atomiks.github.io&#x2F;30-seconds-of-css&#x2F;#pretty-text-underline" rel="nofollow">https:&#x2F;&#x2F;atomiks.github.io&#x2F;30-seconds-of-css&#x2F;#pretty-text-und...</a>) looks pretty awful on Chrome 63.0.3239.132 (Official Build) (64-bit).<p>I like this!
评论 #16475330 未加载
评论 #16476105 未加载
IChrisIover 7 years ago
Popout menus are often created with Javascript with a delay of a second or two before they disappear, such that slower users can move their mouse from a tall element, over non-menu space, onto a menu item.<p>With the CSS popout menu, the menu disappears instantly, making navigation more difficult.
评论 #16479809 未加载
chimenover 7 years ago
Horizontal and vertical centering - needs a height on the parent which is omitted from the example.
评论 #16474595 未加载
评论 #16474896 未加载
swaggyBoatswainover 7 years ago
Looks like inspiration was drawn from 30secondsOfCode repo<p><a href="https:&#x2F;&#x2F;30secondsofcode.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;30secondsofcode.org&#x2F;</a>
karmakazeabout 7 years ago
This is fantastic. Not only as a collection, but also the techniques used within the collection to apply in other situations.<p>&gt; Browser Support: 84.6%<p>The percentage isn&#x27;t very helpful. If a specific set of browsers are to be supported, even 99% may omit one of them.
jenthovenover 7 years ago
This is an awesome cheat sheet. I’ve been struggling with the constant aspect ratio problem!
newusertodayover 7 years ago
can i use custom css element&#x27;s defined in some other library in another css? e.g. I have some html say &lt;nav&gt; ...&lt;&#x2F;nav&gt; i have a separate css style.css which would be .nav{ &lt;class defined in the library i am importing&gt; } basically i don&#x27;t want to spray div&#x2F;classes everywhere while i am experimenting with which css lib to choose, is there any elegant way to do this?
评论 #16479250 未加载
fnyabout 7 years ago
&gt; Pretty text underline without clipping descending letters.<p>Isn&#x27;t this the default behavior?
评论 #16478272 未加载
评论 #16478687 未加载
AccountCreatedover 7 years ago
This is awesome - thank you!
majortennisover 7 years ago
clearfix example not working in ff
madrafiover 7 years ago
I love you
duxupover 7 years ago
Is the link dead for anyone else?<p>Never mind, local issue with me.
评论 #16473511 未加载