Parsel: A tiny, permissive CSS selector parser

Category Image 052

If you’ve ever thought to yourself, gosh, self, I wish I could have an Abstract Syntax Tree (AST) of this CSS selector, Lea has your back.

If you’ve ever thought that same thing for an entire CSS file, that’s what PostCSS is, which has gone v8. PostCSS doesn’t do anything by itself, remember. It just makes an AST out of CSS and gives it a plugin interface so plugins can be written to transform CSS with it. No shade on PostCSS, but it is funny how saying “We use PostCSS” doesn’t mean anything the way “We use Sass” does.

Direct Link to ArticlePermalink


The post Parsel: A tiny, permissive CSS selector parser appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

What is the Value of Browser Diversity?

Category Image 052

In 2018, Rachel Nabors made the point that browser diversity is similar to biological ecosystem diversity. There are literal advantages to more diversity. That article was before the Edge engines were shut, and now the big shakeups at Mozilla have the topic of browser diversity on people’s minds again.

I really like Dave’s take on the matter. The diversity of browser engines makes web tech slow. Frustratingly slow, to many, but that slowness can bring value.

There’s a lot of value in slow thinking. You use the non-lizard side of your brain. You make more deliberate decisions. You prioritize design over instant gratification. You can check your gut instincts and validate your hypothesis before incurring mountains of technical debt.

I’d bet you a dollar that the less engines we have, the faster things get. Fast can be satisfying in the moment, but doesn’t make for the best brisket.

If we do see a major reduction in browser diversity, I think we lose the intentional slowness and the cooperation mechanisms we have in place. Who knows what will happen, but my hope is that just like iron can sharpen iron, maybe chromium can sharpen chromium.

Direct Link to ArticlePermalink


The post What is the Value of Browser Diversity? appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Using a brightness() filter to generically highlight content

Category Image 052

Rick Strahl:

I can’t tell you how many times over the years I’ve implemented a custom ‘button’ like CSS implementation. Over the years I’ve used images, backgrounds, gradients, and opacity to effectively ‘highlight’ a control. All that works of course, but the problem with most of these approaches is that one way or the other you’re hard coding a color value, image, or gradient.

You certainly have a lot more control if you specify exact colors, but if you can pull off brightening, darkening, or even a hue-shift in a way that feels cohesive on your site, it’s certainly a lot less code to maintain,

.button.specific-button {
  background: #4CAF50;
}
.button.specific-button:focus,
.button.specific-button:hover {
  background: #A5D6A7;
}

/* vs. */
.button:focus,
.button:hover {
  filter: brightness(120%);
}

/* or maybe you're super hardcore and do it everywhere */
:focus,
:hover {
  filter: brightness(120%) saturate(120%);
}

Direct Link to ArticlePermalink


The post Using a brightness() filter to generically highlight content appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

To grid or not to grid

Category Image 052

Sarah Higley does accessibility work and finds that “tables and grids are over-represented in accessibility bugs.”

The drum has been banged a million times: don’t use a <table> for layout. But what goes around comes around. What’s the the #1 item in a list of “some of the ways tables and grids can go wrong”?

Using a grid when a table is needed, or vice versa

The day has come. CSS grid has dug its way into usage so deeply that developers are using it by default instead of using a classic <table>. And we don’t even have flying cars yet!

Sarah shows clear examples of both techniques and how the same information can be presented in different ways both visually and semantically. For example, a list of upcoming concerts can be displayed as a <table>, and that might be fine if you can imagine the purpose of the table being used for sorting or comparing, but it can also be presented as a grid, which has other advantages, like headers that are easier to skim.

Direct Link to ArticlePermalink


The post To grid or not to grid appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Our Website is not coming google 1st page

Featured Imgs 11

Hello all , Our website not ranking on google 1st page . We have done everything , content writing , back links, comments ..etc also spent huge money on google ads and Facebook ads, but no use for it. I have checked many website and their back link is very less also website speed is very less but their website is ranking good .Now our hope is "DANIWEB" . I need your suggestions and guidelines. our website is https://www.bismatrimony.com/

Regards

Soniya Bis

System UIcons

Category Image 052

This is a great collection of icons by Corey Ginnivan that’s both free and with no attribution required when you use them. The style is super simple. Each icon looks like older versions of the icons from macOS to me because they’re cute but not too cute.

Also? The icon picker UI is slick and looks something like this today:

Oh and also, as I was looking around Corey’s personal site I noticed this lovely UI effect when you scroll —each card stacks on top of each other:

Direct Link to ArticlePermalink


The post System UIcons appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

zerodivs.com

Category Image 052

Pretty neat little website from Joan Perals, inspired by stuff like Lynn’s A Single Div. With multiple hard-stop background-image gradients, you don’t need extra HTML elements to draw shapes — you can draw as many shapes as you want on a single element. There is even a stacking order to work with. Drawing with backgrounds is certainly CSS trickery!

The site stores your drawing IDs in localStorage so you’ve got basic CRUD functionality right there. I bet the whole thing is a little hop away from being an offline PWA.

Direct Link to ArticlePermalink


The post zerodivs.com appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

What does 100% mean in CSS?

Featured Imgs 23

When using percentage values in CSS like this…

.element {
  margin-top: 40%;
}

…what does that % value mean here? What is it a percentage of? There’ve been so many times when I’ll be using percentages and something weird happens. I typically shrug, change the value to something else and move on with my day.

But Amelia Wattenberger says no! in this remarkable deep dive into how percentages work in CSS and all the peculiar things we need to know about them. And as is par for the course at this point, any post by Amelia has a ton of wonderful demos that perfectly describe how the CSS in any given example works. And this post is no different.

Direct Link to ArticlePermalink


The post What does 100% mean in CSS? appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

How To Completely Customize The WordPress Admin Area With Branda

Featured Imgs 13

Branda gives you the power to white label WordPress, letting your brand flow from the front to the back-end of your site. In this guide, we’ll show you how to renovate your admin area with some of Branda’s most impressive features.

White labeling your WordPress site has never been easier. Branda splits every one of her features into easy to digest modules which can be activated and removed as necessary.

Branda lets you white label every Aspect of WordPress

No job is too big or small – you can customize anything from your color scheme and dashboard widgets, right down to the text labels on your login page, and the icons in your admin toolbar.

In this guide, we’ll show you not only how to completely white label the back-end of your WordPress installation using Branda, but also how to personalize and reorganize your tools and menus to ensure peak efficiency when working within your admin area.

We’ll be covering how to:

  1. Customize Your Login Screen
  2. Change the WordPress Logo
  3. Rework the Admin Bar
  4. Personalize Your Widgets
  5. Organize Your Admin Menu
  6. Add Text to Your Footer
  7. Text Replacement
  8. Change the Color Scheme

Read on to find out how Branda can help you put your own stamp on your WordPress admin.

1. Customize Your Login Screen

When customizing your WordPress admin, it makes sense to start at the first page you’ll always see – the login screen.

Branda can help you create a completely new login screen that will impress your clients and inject some personality into your WordPress back-end.

There are seven preset templates you can select, or you can create your own from scratch.

Screenshot of Branda's login screen templates.
Click ‘Start from scratch’ to create your own template.

If you start from scratch, the main changes will come in the form of your background and logo.

First up is the logo – you can either upload your own image, or import one from a URL.

Screenshot of the logo option where you can upload your own image.
You can also choose to completely hide the logo.

Once you’ve added your logo, you can choose a new background to complement it.

Screenshot of a custom login screen made using Branda and an image of some notepads.
Just make sure your background image is a minimum of 1024px wide.

You’re free to take it even further and edit or hide the labels, display a message, or add custom error messages.

Add custom messages for users when they log in.

A few tweaks and you can completely revamp your login section.

If you’re a developer working on a lot of sites, or if you’re trying to create a personalized experience for a new client, the ability to switch out the WordPress logo in the admin bar can make a lot of difference.

It can let you know at a quick glance which site you’re currently logged into and it can be the icing on a cake for a client that you’re trying to impress.

With Branda, it takes seconds to change the logo to something more personal.

This setting is found within Admin Area > Admin Bar.

As you can see below, it’s such a simple change but it takes white labeling WordPress to the next level.

Screenshot of the admin bar with a custom logo in it
It’s your site, so it makes sense to replace the WordPress logo with your own.

3. Rework the Admin Bar

If you find the admin bar more unsightly than useful, there are a couple of ways Branda can help you manage this.

You can remove the admin bar from your front-end if you want to quickly view your site without it getting in the way by heading to Admin Area > Admin Bar.

Screenshot of the options to set the toolbar visibility by user account.
Untick the boxes of the user roles you wish to hide the toolbar from on the front-end.

If you don’t want to hide the toolbar completely, you can customize the items it shows.

Start by choosing the items you wish to hide:

Screenshot of the various options you can hide from the toolbar.
Better still, you can apply these settings to specific user roles.

If you really dislike the toolbar, you can even go as far as removing all its links in the back-end:

Screenshot of a toolbar with all the items removed.
Branda can help your admin area go from ‘messy’ to ‘minimalist’ in just a few clicks.

If you’d prefer an admin bar that is practical and personalized to fit your needs, you can create this by adding custom items to it.

Screenshot of the option to add a custom admin bar item.
Just below the option to hide your items, you’ll find the option to add custom ones.

Once you click to add a custom item, you will need to select a title, icon and a link destination.

Screenshot of the the option to select a title and icon for a custom admin menu item.
There are tons of icons to choose from – you’ll be spoilt for choice.

Add a submenu if required, and set the visibility of your new menu item per user role.

Screenshot of a custom admin bar menu item with a submenu.
You can use these settings to easily navigate to your most important pages, as well as a host of other ideas.

4. Personalize Your Widgets

With all the standard widgets active, your dashboard can begin to look a bit cluttered.

If you head into Branda and to Widgets > Dashboard Widgets, you can hide any that you don’t use.

Screenshot of the widgets you can hide.
With all these options ticked, your dashboard will be completely free of widgets.

You can then begin to repopulate your dashboard with widgets that are more useful to you, as Branda has the option to create your own custom widgets.

Screenshot of the option to add a new text widget.
You can create your own unique widget and then choose which user roles will see it.

Widgets can contain notes, company updates, stock reminders – you have total freedom.

Screenshot of a custom widget showing some upcoming appointments.
They’re so quick and easy to update.

Your admin menu is the heart and soul of your WordPress admin area. If you want to customize the back-end of your site, it makes sense to tailor the admin menu to your needs.

Head to Admin Area > Admin Menu > Customize Admin Menu and you will be presented with a ton of options to help you get the most out of your admin menu.

First up, you can customize each item in your admin bar per user role and can opt to hide each item.

Screenshot of the option to edit your dashboard menu item.
You can also duplicate items from this menu.

When you click to edit one of the items, you are first offered the chance to rename it as well as change the CSS ID and class.

Screenshot of the option to change the ID and class of the menu item.
Click ‘submenu’ to change the name and IDs/classes of the submenu items.

If you scroll down a little further, you can choose a new icon from tons of presets.

Screenshot showing some of the icons Branda comes preloaded with,.
You can even upload your own icons.

Once you are satisfied with how your menu item looks, it’s time to decide what happens when you click on it.

Underneath the icons, you will find the option to change the link, as well choose whether or not it opens in a new tab.

Screenshot of the option to add a link to the custom menu item.
While you may not need to change the link on existing menu items, it’s handy if you create new ones.

Once you have amended your existing menu items to your taste, you can scroll to the bottom of the list to add your own custom items.

This is useful if you want shortcuts to external websites or areas of your site that take a while to navigate to.

You can add text or even media to the bottom right of your admin area.

This could be anything from an important message or update, to your company motto, or even just your site name.

Screenshot of custom admin footer text which says Kirstan's Blog, 2020.
You can also make the text a link.

It’s just another quick way to break out of WordPress’ usual template and add a bit of brand/personality to your admin area.

7. Text Replacement

A handy feature found within the utilities section of Branda allows you to replace words and phrases throughout your site.

This can be especially beneficial when it comes to white labeling your admin area.

You can control whether the rules are case sensitive, and whether they apply everywhere or just on your front or back-end.

Screenshot of the option to add a text replacement rule showing Howdy replaced with Welcome Back
Even apply it to specific themes or plugins using the text domain option.

Using this feature, you can easily change the ‘Howdy’ message on the right-hand side of your admin bar, to something more to your taste.

Screenshot of the admin bar showing a custom Howdy message which say Welcome Back.
You can add as many separate rules as you like.

8. Change Your Color Scheme

If you’re dedicated to truly whitelabeling and personalizing your site, then changing the color scheme should definitely be on your to-do list.

Branda comes loaded with 8 color schemes for you to choose from.

Screenshot of the preset color schemes which come with Branda.
You can set the theme for each user individually or apply to all.

If your plan is to match your admin area to your brand, you can extensively edit the color schemes to your exact requirements.

Below is just a taste of how many options you have to create your own scheme.

You can color each element of your admin area separately, and tweak things such as hover and focus color.

Screenshot of the admin area using the theme Ocean.
This is ‘Ocean’, one of Branda’s preset color schemes.

WordPress Who?

Branda has so many options for customization and white labeling that you can put the same love and care into the back-end of your site as you do the front. No longer will you have to gaze upon the WordPress logo or endure every site you work on looking exactly the same from the back-end. With Branda, you can truly make each site your own.

If you’re eager to find out what else Branda can do, check out the documentation for a complete run down and visit our roadmap to see what else she’s got in store. Better yet, get Branda installed and experience the power of personalizing WordPress with Branda for yourself.

Warp SVG Online

Category Image 052

The warping is certainly the cool part here. Some fancy math literally transforms the path data to do the warping. But the UX detail work here is just as nice. Scrolling the page zooms in and out via a transform: scale() on the SVG wrapper (clever!). Likewise, holding the spacebar lets you pan around which is as simple as transform: translate() on another wrapper (smart!). To warp your own SVG files, you just drag-and-drop them on the page (easy!).

Direct Link to ArticlePermalink


The post Warp SVG Online appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Should WordPress Themes Add a Top-Level Admin Menu Item?

Featured Imgs 08

WordPress has almost always provided a top-level admin menu item for themes. It is clearly labeled “Appearance.” It is the single location that all WordPress users know to visit to modify any appearance-related things for their WordPress site. However, there is a movement within the Themes Team to allow themes to place an additional top-level menu link in the admin. The big question: should this idea move forward?

When the Themes Team (originally called the Theme Review Team) was formed, its members created a set of guidelines that would be shaped and reshaped over the years. They were a set of living guidelines that could always be changed with the times.

One of the oldest guidelines required that themes must place any custom admin pages under the Appearance menu item. It made sense. WordPress provided a standard location for any theme-related pages. The custom header and background features lived under Appearance. Widgets, also defined by the current theme, were housed as a sub-page. Eventually, WordPress’s custom nav menu system came along and was — you guessed it — situated under Appearance. The core developers even put the customizer link in the same place.

For over a decade, there was a well-defined standard. Sure, commercial themes outside of the official directory would sometimes break the mold. However, themes from the directory followed the pattern.

Now, the Themes Team is proposing that themes should be able to break from tradition.

The discussion arose after a question of whether themes should be able to add a custom panel to the block editor sidebar, which is not allowed.

“To keep the editor free from clutter, advertising and upsell, with the customizer being used less, and no dashboard widgets being allowed, can we give theme authors a better place to include their information, and limit upsell to that area?” wrote Carolina Nymark in last week’s team meeting notes.

The proposal seems to settle on the idea that themes will lose visibility as WordPress moves toward full-site editing and the customizer becomes less important. The customizer is not an ideal place for anything but theme options, but that notion seems to have been overlooked in the discussion. Nevertheless, the original guideline that disallowed themes from creating top-level menu items preceded the advent of the customizer by several years. Advertising, documentation, plugin recommendations, and similar pages were always allowed under the existing Appearance menu. The usefulness of the customizer was never a necessary part of that conversation.

Ultimately, the question should be about what is best for users. There is no data to support making the change or sticking with the status quo. However, we do have a standard that has existed for years.

The Proposed Guidelines

The proposal would create several new guidelines for theme authors to follow and reviewers to check, assuming the theme created a top-level admin menu item:

  • No admin menu priority may be used.
  • No UI or color changes are allowed for the menu item.
  • The title must be kept short and not include spam.
  • No more than three sub-pages.
  • Child themes are limited to one sub-page or can remove the parent’s pages and add its own.

Some of these make sense and follow along with existing guidelines, such as not spamming or changing the admin UI. However, others could be problematic.

If moving forward with the proposal, setting a menu item priority should be required rather than not allowed. If anything, it would make sense to require a specific priority to place the custom menu item immediately after the existing Appearance item. This would at least group them together by default. If changing the place where users are accustomed to seeing theme-related pages, it is probably best not to break too far from the standard location.

No more than three sub-pages? Surely there will be a theme with a top-level admin menu item that needs four sub-pages at some point. If giving theme authors the freedom to take up valuable real estate in the admin, a limit of three sub-pages seems like a rule to fix the mistake of allowing the top-level item in the first place. It is an arbitrary number at best. There would be no reason to cap it once making the guideline change. It also adds one more item that the team will need to police.

The limitation of sub-pages for child themes seems just as arbitrary. No such limitation exists when placing sub-pages under the standard Appearance screen.

The entire proposal is little more than extra work on a team that is already strained for resources.

Instead of the simple rule that has existed for years, the proposal adds a new rule with several sub-rules. If the team desires the extra work, I suppose this point doesn’t matter.

The Elephant in the Room

There is one Aspect of this discussion that everyone knows about but few are willing to broach. Underneath all the guidelines from the Themes Team and whether most theme authors support a particular decision is how this affects the financial bottom line. When we talk about visibility of a theme’s admin pages, we are primarily talking about providing another avenue for commercial upsells.

Some of this discussion on visibility is shrouded in concepts such as surfacing end-user documentation or adding a visible readme for the user’s benefit. These are legitimate concerns, especially when theme developers have watched tickets to address such downfalls seemingly dwindle into obscurity over the years. Whether a top-level admin menu item makes sense for exposing theme documentation might be worth discussing, but there is no world in which this would be the primary use case.

The topic of visibility rests on the idea of upselling the pro version of the theme, add-ons, or other services.

Far too many plugins already go overboard, creating a billboard of the WordPress admin. One of the things users could almost be assured of is that themes from the official directory were constrained enough that they were not the hot mess that plugins have become as of late. However, that could all change.

Do we really want an extra top-level admin menu item that will be, for all intents and purposes, to advertise?

Maybe it doesn’t matter in the end. Users are so accustomed to the clutter produced by the dozens of plugins on their sites. One more may not matter at this point.

Or, should we be having a different conversation altogether? If this ultimately boils down to advertising, are there ways we can open this up for theme authors while still creating a user experience that keeps the WordPress admin free of clutter?

How-to guide for creating edge-to-edge color bars that work with a grid

Category Image 052

Hard-stop gradients are one of my favorite CSS tricks. Here, Marcel Moreau combines that idea with CSS grid to solve an issue that’s otherwise a pain in the butt. Say you have like a 300px right sidebar on a desktop layout with a unique background color. Easy enough. But then say you want that background color to stretch to the right edge of the browser window even though the grid itself is width-constrained. Tricker.

Direct Link to ArticlePermalink

The post How-to guide for creating edge-to-edge color bars that work with a grid appeared first on CSS-Tricks.

Global and Component Style Settings with CSS Variables

Featured Imgs 23

The title of this Sara Soueidan article speaks to me. I’m a big fan of the idea that some CSS is best applied globally, and some CSS is best applied scoped to a component. I’m less interested in how that is done and more interested in just seeing that conceptual approach used in some fashion.

Sara details an approach where components don’t have too much styling by default, but have CSS custom properties applied to them that are ready to take values should you choose to set them.

For each pattern, I’ve found myself modifying the same properties whenever I needed to use it — like the font, colors (text, background, border), box shadow, spacing, etc. So I figured it would be useful and time-saving if I created variables for those properties, define those variables in the ‘root’ of the component, and ‘pass in’ the values for these variables when I use the pattern as I need. This way I can customize or theme the component by changing the property values in one rule set, instead of having to jump between multiple ones to do so.

Direct Link to ArticlePermalink

The post Global and Component Style Settings with CSS Variables appeared first on CSS-Tricks.