Wednesday, February 5

CSS Tricks

Fast, Good, Local Site Search with Jetpack
CSS Tricks

Fast, Good, Local Site Search with Jetpack

If you have, say, 20 posts/pages on your WordPress site, the search functionality that is baked right into your self-hosted WordPress site will probably do a great job. Search is a pretty cool feature to ship with WordPress, truth be told. But as a site grows, you'll find limits. How it works behind the scenes is a touch over my head, but as I understand it, it does a MySQL LIKE query on your post titles and post content. It tries its best to order by relevance (like if it finds an exact sentence match), then largely orders by date. If search is super important to your site (here on CSS-Tricks, on-site search gets used a ton) you'll probably look for other options. TLDR: Jetpack Search is quite good out of the box, customizable, and requires very little effort. A quick jaunt through a de...
CSS Tricks

Unused

I recently wrote Here’s the thing about "unused CSS" tools, where I tried to enumerate all the challenges any tool would have in finding truly "unused" CSS. The overarching idea is that CSS selectors match elements in the DOM, and those elements in the DOM come from all sorts of places: your static templates, dynamic templates based on server-side state, and of course, JavaScript, which can manipulate the DOM in any way at all, including pull things from APIs and third parties. With all that at play, how can any tool give us a truly accurate picture of unused CSS, to the point that actually removing that CSS isn't just as dangerous as leaving it alone? So, I said: And yet, I don't think these tools are useless — they are just...tools. Their use can actually be a positive step toward bett...
CSS Tricks

Emojis as Icons

There are lots of unicode symbols that make pretty good icons already, like arrows (←), marks (✘), and objects (✂︎).You can already colorize these like a normal font glyph. Then, there are emojis, those full-color suckers we all know about. What if you could take just the shape of an emoji and use it like a normal glyph? You can! Preethi Sam shows how: .icon { color: transparent; text-shadow: 0 0 #ec2930; } Plus, an alternate technique using background-clip. Note that emojis render differently across platforms, so careful! Direct Link to Article — PermalinkThe post Emojis as Icons appeared first on CSS-Tricks. Source: CSS-tricks.com
Hyperlinking Beyond the Web
CSS Tricks

Hyperlinking Beyond the Web

Hyperlinks are the oldest and the most popular feature of the web. The word hypertext (which is the ht in http/s) means text having hyperlinks. The ability to link to other people’s hypertext made the web, a web — a set of connected pages. This fundamental feature has made the web a very powerful platform and it is obvious that the world of apps needs this feature. All modern platforms support a way for apps to register a URI (custom protocol) and also have universal links (handling web links in an app). Let’s see why we’d want to take advantage of this feature and how to do it. Why have app links at all? Creating URIs that apps can open provides a unique set of benefits. A URL encapsulates the entire state of the webpage (it used to before the advent of Single Page Applications (SPAs) h...
CSS Tricks

Random Day in the Life of a Developer

Yesterday, I started going through my email as soon as I got to work. I always start my day with email. I kinda like email. I read some interesting things in keeping up with the industry. I deal with some business things. I handle with some personal things. I make a note of the most important stuff going on. Then I kept working! I fixed a bug that was affecting Firefox exclusively. This code would set some elements in a row with flexbox, let them wrap, then looked at all of them to see which ones wrapped and which ones didn't. Then it put the ones that wrapped in an overflow menu. Seemed simple enough. But some of the items were in bold text and some were not. The ones that were not bold were somehow pushed down 1.5px in Firefox (but in no other browser I looked at). The code checked to ...
Delivering WordPress in 7KB
CSS Tricks

Delivering WordPress in 7KB

Over the past six months, I've become increasingly interested in the topic of web sustainability. The carbon footprint of the Internet was not something I used to give much thought to, which is surprising considering my interest in environmental issues and the fact that my profession is web-based. The web in a warming world As a brief recap, I attended MozFest in London last year. In between sessions, I was scanning a noticeboard to see what was coming up, and I spotted a session entitled, "Building a Planet-Friendly Web." I felt a little dumbstruck. What on Earth was this going to be about? I attended the session and the scales fell from my eyes. In what now seems obvious — but at the time was a revelation — I learned of the colossal energy demand of the Internet. This demand makes it th...
CSS Tricks

itty.bitty

Mark this down as one of the strangest things I’ve seen in a good long while. Nicholas Jitkoff has made a tool called itty.bitty that creates websites with all of the assets being contained within their own link. You can create a website without any HTML or CSS resources at all because it’s all been base64 encoded into the URL itself. Take this crazy looking URL, for example: https://itty.bitty.site/#How_it_works/XQAAAAJdDAAAAAAAAAAeHMqHyTY4PyKmqfkwr6ooCXSIMxPQ7ojYR153HqZD3W+keVdvwyoyd+luwncAksxo8PWJs+831jtAVty8rDpGXmyebtxMTP3PSa4g8/593sWue8WaPjJZKXPqJ+G6ffUrBFhdclCfPRZ1gVobusxdd5g4xI5328XhoOoeADUFQZMeRzfBVzcSlEdUqLcxhD5c7kYCBo79g1FR9+rRyw0U3Jyc+5Axt5HWUqKPcEBfQpO35dwvNhCOOZQ/83PRzl51VrpqJ+zwl7UT1JUUK24g/b9zCUO6EIGg1bcZW0VBL53SSK4LE+UkJNv3WKY04UQnISAISa4WghBZjXT5ID0S61leAohaQ9Kqkv6fGfZKI+...
Little Tip: Draw Your Grid in ASCII in Your CSS Comments for Quick Reference
CSS Tricks

Little Tip: Draw Your Grid in ASCII in Your CSS Comments for Quick Reference

Say you declared a grid like this: body { display: grid; grid-template-columns: min-content 1fr; grid-template-rows: min-content auto min-content; } This depends on content, for sure, but how it's likely to play out is like this: +---+-------------+ | | | | | | +-----------------+ | | | | | | | | | | | | | | | | | | +-----------------+ | | | +---+-------------+ That's really easy to draw out quick in ASCIIFlow Infinity. Now you want to place elements in that grid, and arguably the easiest way to do that is to specify the grid rows/columns they should start/end at. /* grid-area: row-start / column-start / row-end / column end */ .logo { grid-area: 1 / 1 / 2...
The CSS Paint API
CSS Tricks

The CSS Paint API

The CSS Paint API is extremely exciting, not only for what it is, but what it represents, which is the beginning of a very exciting time for CSS. Let’s go over what it is, why we have it and how to start using it. What is the CSS Paint API? The API is just one part of a whole suite of new specifications all under the umbrella of what is known as CSS Houdini. Houdini, in essence, gives developers lower level access to CSS itself. No kidding. The CSS Paint API specifically allows you to call a paint() function wherever you would normally write a value where an image is expected. A common example is the background-image property, where you might use the url() function to a link to an image file, like this: area { background-image: url('assets/myimage.jpg'); } The CSS Paint API allows you t...
CSS Grid in IE: Faking an Auto-Placement Grid with Gaps
CSS Tricks

CSS Grid in IE: Faking an Auto-Placement Grid with Gaps

This is the third and final part in a three-part series about using CSS grid safely in Internet Explorer 11 (IE11) without going insane. In Part 1, I covered some of the common misconceptions that people have about IE11’s native CSS grid implementation. In Part 2, I showed the world how easy it actually is to write IE-friendly CSS grid code. Today, I’m going step away from CSS grid for a moment to show you a flexbox technique that replicates basic CSS grid auto-placement functionality. This CSS grid replica will even look like a grid-gap has been applied to it. I need to be super clear though: this is not about how to make actual CSS grid auto-placement work in IE. Article Series: Debunking Common IE Grid Misconceptions CSS Grid and the new Autoprefixer Faki...
CSS Tricks

Prototyping in the Browser

Prototyping animations and interactions is vital for a number of reasons: they can make your interface feel deceptively fast, they can help focus the user on a specific task, and they can provide a better sense of the current state of your application. Is data being loaded? Is something now unclickable? How long do they have to wait until they can perform an action? At Gusto, I’ve been working on a lot of tiny interaction details and prototypes lately for these very reasons — sadly there’s not much that I can show you all in detail just yet. But, I think the process of how I’m doing this is far more interesting than what I’m actually working on so that's what I'm going to share here. The problem I’ve faced with prototyping animations comes down to the tools because they ultimately feel r...
CSS Tricks

​Reinvest Your Time with HelloSign API

HelloSign API makes it simple to embed secure and legally binding eSignatures directly into any website. It's 2x faster to implement than other eSign solutions and is also the only eSign API that allows customers to completely white label the integration, meaning our customers can give their customers a seamless, native signing experience. The three key features of the HelloSign API are the ability to collect signatures, request signatures, and format documents for signing directly on any site. Integrations go smoothly with help from tools like the API Dashboard, an industry-first feature that makes it easy for developers to debug and view critical information about API requests and responses. What are you going to do with all that time you saved by using HelloSign API? Try it free today T...
The Eleventh Fourth
CSS Tricks

The Eleventh Fourth

Holy heck it feels like the last year has flown by! Longtime readers will remember that the fourth of July is CSS-Tricks birthday and we blog it each year. We turned 10 last year, and now we welcome our first palindromic number birthday. Huge thank you First, as ever, thank you for being part of CSS-Tricks. However you end up here, we hope that we're useful to you, know that we're always trying to be even more useful to you, and know that you make the site possible. Can we ask you some questions? The whole point of this survey is to understand you better and use that understanding to make choices that serve you better. That's it! It's super helpful to us and totally anonymous. Take the CSS-Tricks Reader Survey A new design is coming Hate to be a tease, as there is nothing to show you ye...
CSS Tricks

CSS Grid in IE: CSS Grid and the New Autoprefixer

In Part 1 of this series, I debunked a few misconceptions that many people have around the Internet Explorer (IE) implementation of CSS grid. This article builds on that knowledge. It would be best to go back and read that article first if you haven’t already. Today I’m going to be tackling the biggest misconception of all: that utilizing the IE implementation of CSS grid is extremely difficult. You can easily use CSS grid in IE right now without having to give it any sort of crappy fallback layout. It really isn't that hard. Article Series: Debunking Common IE Grid Misconceptions CSS Grid and the new Autoprefixer (This Post) Faking an auto-placement grid with gaps (Coming Soon!) Giving IE a crappy fallback layout is a bit of a tough sell to clients. It...
Clearfix: A Lesson in Web Development Evolution
CSS Tricks

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 wreck havoc on a layout. All you might be trying to do is position a sidebar to the left of your main ...