Black Friday / Cyber Monday Sale

We are having a Black Friday / Cyber Monday sale on our premium WordPress plugins! Save 30% on lifetime licenses for awesome plugins like USP Pro, BBQ Pro, Blackhole Pro, and more. To save, apply coupon code BLACKFRIDAY2019 during checkout. This is a one-time-per-year event that expires December 3rd!

* Sweet Friday goodness: the same coupon code also works for any of our WordPress books or combos at Perishable Press Books :)

Direct link to article | View post at DigWP.com

This Week in Spring: Thanksgiving Edition

Check out this year's Thanksgiving edition of ''This Week in Spring.''

Hi, Spring fans! Welcome to yet another installment of This Week in Spring! This week, I’m in Tokyo, Japan, for the Pivotal Summit Japan event. I’ve regretfully had to miss the China and Korea events because of a family emergency, so it’s nice to be able to make this, the last stop on the tour, before returning to California to celebrate Thanksgiving with my family.

And, on that note… it’s almost Thanksgiving in the US. Thanksgiving is a time for us in the US to reflect on that for which we’re thankful. I think I speak for the entire Spring team when I say that we are very grateful for you all, dear (worldwide) community! Happy Thanksgiving, all!

This Week in Spring: Releases, Podcasts, Tutorials, and More

We've got a lot in store This Week in Spring — check it out!

Hi, Spring fans! What a week! I've just returned from Prague, the Czech Republic, where I was for the epic Geecon Prague 2019 event. (Thanks for voting my talk on Reactive Spring the #1 talk, Prague!). Now, I'm in Nantes, France, the DevFest Nantes show. I'd never been to Prague and I've never been to Nantes. So how's that for cool first-time appearances in one week?

Tonight, I fly to Paris, France, for customer meetings. Then, I fly on Thursday to St. Petersburg, Russia, for the Joker conference, where I'll be presenting on testing. I'll be co-presenting with Spring co-founder, my friend, and hero, the one, the only, the amazing and inimitable, a veritable font of kindness and wisdom, Juergen Hoeller! Then, on the 27th, I fly to Chicago. It's shaping up to be quite the week!

New Plugin: Override Comment Options

WordPress provides an option called "Automatically close comments on articles older than x days". It really helps to stop spam on older blog posts. The problem is that, when the setting is enabled, there is no way to override for individual posts. So I wrote a simple lightweight plugin that enables you to override the auto-close setting and leave comments open on any posts that you want.

Direct link to article | View post at DigWP.com

Java Annotated Monthly — October 2019

Wow, what a bumper month! Summer is well and truly over and we are Being Productive! This month's edition is absolutely huge and I didn't even do any particular research for the newsletter; there was just a lot of interesting stuff kicking around. Of course, we have Java 13, and I've added two new sections: career advice and testing. Not testing your career, although that would be really useful too. There are also a lot of Spring Boot tutorials because I've been leaning on Google a lot this month for my live coding demo for Spring One Platform in Austin next week. Set aside some serious time for this edition!

Java News

Java 13 came out in September. It’s another short-term release, but it does mean that if you were on Java 12 your JDK is no longer supported and you should upgrade to 13. If you’re on Java 11 or 8, watch my video (last link below) to understand some of the questions you should be asking in order to decide whether to upgrade,

Breakout Buttons

Andy covers a technique where a semantic <button> is used within a card component, but really, the whole card is clickable. The trick is to put a pseudo-element that goes beyond the button, covering the entire card. The tradeoff is that the pseudo-element sits on top of the text, so text selection is hampered a bit. I believe this is better than making the whole dang area a <button> because that would sacrifice semantics and likely cause extreme weirdness for assistive technology.

See the Pen
Semantic, progressively enhanced “break-out” button
by Andy Bell (@andybelldesign)
on CodePen.

You could do the same thing if your situation requires an <a> link instead of a <button>, but if that's the case, you actually can wrap the whole area in the link without much grief then wrap the part that appears to be a button in a span or something to make it look like a button.

This reminds me of the nested link problem: a large linked block that contains other different linked areas in it. Definitely can't nest anchor links. Sara Soueidan had the best answer where the "covering" link is placed within the card and absolutely positioned to cover the area while other links inside could be be layered on top with z-index.

I've moved her solution to a Pen for reference:

See the Pen
Nested Links Solution
by Chris Coyier (@chriscoyier)
on CodePen.

The post Breakout Buttons appeared first on CSS-Tricks.

The Many Ways to Link Up Shapes and Images with HTML and CSS

Different website designs often call for a shape other than a square or rectangle to respond to a click event. Perhaps your site has some kind of tilted or curved banner where the click area would be awkwardly large as a straight rectangle. Or you have a large uniquely shaped logo where you only want that unique shape to be clickable. Or you have an interactive image that responds differently when different regions of it are clicked.

You can surround those assets with an un-styled <a> tag to get a clickable rectangle that's approximately the right size. However, you can also control the shape of that region with different techniques, making sure the target for your click area exactly matches what’s visible on the screen.

SVG shapes

If your click target is an image or a portion of an image, and you have the ability to choose SVG as its format, you already have a great deal of control over how that element will behave on your page. The simplest way to make a portion of an SVG clickable is to add an an SVG hyperlink element to the markup. This is as easy as wrapping the target with an <a> tag, just as you would a nested html element. Your <a> tag can surround a simple shape or more complex paths. It can surround a group of SVG elements or just one. In this example the link for the bullseye wraps a single circle element, but the more complex arrow shape is made up of two polygons and a path element.

See the Pen
target svg
by Bailey Jones (@bailey_jones)
on CodePen.

Note that I’ve used the deprecated xlink:href property in this demo to ensure that the link will work on Safari. The href alone would have worked in Internet Explorer, Chrome, and Firefox.

The only trick here is to make sure the <a> tag is inside the SVG markup and that the tag wraps the shape you want to be clickable. The viewbox for this SVG is still a rectangle, so wrapping the entire SVG element wouldn't have the same effect.

Image maps

Let’s say you don’t have control over the SVG markup, or that you need to add a clickable area to a raster image instead. It’s possible to apply a clickable target to a portion of an <img> tag using an image map.

Image maps are defined separately from the image source. The map will effectively overlay the entire image element, but it's up to you to define the clickable area. Unlike the hyperlink element in the SVG example, the coordinates in the image map don’t have anything to do with the definition of the source image. Image maps have been around since HTML 3, meaning they have excellent browser support. However, they can’t be styled with CSS alone to provide interactive cues, like we were able to do with SVG on hover — the cursor is the only visual indicator that the target area of the image can be clicked. There are, however, options for styling the areas with JavaScript.

W3 Schools has an excellent example of an image map using a picture of the solar system where the sun and planets are linked to close-up images of those targets — everywhere else in the image is un-clickable. That’s because the coordinates of the areas defined in their image map match the locations of the sun and planets in the base image.

Here’s another example from Derek Fogge that uses uses maps to create more interesting click targets. It does use jQuery to style the areas on click, but notice the way a map overlays the image and coordinates are used to create the targets.

See the Pen
responsive image map demo
by Derek Fogge (@PositionRelativ)
on CodePen.

You can implement image maps on even more complex shapes too. In fact, let’s go back to the same target shape from the SVG example but using a raster image instead. We still want to link up the arrow and the bullseye but this time do not have SVG elements to help us out. For the bullseye, we know the X and Y coordinates and its radius in the underlying image, so it’s fairly easy to define a circle for the region. The arrow shape is more complicated. I used https://www.image-map.net to plot out the shape and generate the area for the image map — it’s made up of one polygon and one circle for the rounded edge at the top.

See the Pen
target image map
by Bailey Jones (@bailey_jones)
on CodePen.

Clip-path

What if you want to use CSS to define the shape of a custom click region without resorting to JavaScript for the styling? The CSS clip-path property provides considerable flexibility for defining and styling target areas on any HTML element.

Here we have a click area in the shape of a five-pointed star. The star is technically a polygon, so we could use a star-shaped base image and an image map with corresponding coordinates like we did in the previous image map example. However, let’s put clip-path to use. The following example shows the same clip-path applied to both a JPG image and an absolutely positioned hyperlink element.

See the Pen
Clip-path
by Bailey Jones (@bailey_jones)
on CodePen.

Browser support for clip-path has gotten much better, but it can still be inconsistent for some values. Be sure to check support and vendor prefixes before relying on it.

We can also mix and match different approaches depending on what best suits the shape of a particular click target. Here, I’ve combined the "close" shape using Bennet Freely’s clippy with an SVG hyperlink element to build the start of a clickable tic-tac-toe game. SVG is useful here to make sure the "hole" in the middle of the "O" shape isn’t clickable. For the "X" though, which is a polygon, a single clip-path can style it.

See the Pen
tic tac toe
by Bailey Jones (@bailey_jones)
on CodePen.

Again, beware of browser support especially when mixing and matching techniques. The demo above will not be supported everywhere.

CSS shapes without transparent borders

The clip-path property allowed us to apply a predefined shape to an HTML element of our choice, including hyperlink elements. There are plenty of other options for creating elements HTML and CSS that aren’t squares and rectangles — you can see some of them in The Shapes of CSS. However, not all techniques will effect the shape of the click area as you might expect. Most of the examples in the Shapes of CSS rely on transparent borders, which the DOM will still recognize as part of your click target even if your users can’t see them. Other tricks like positioning, transform, and pseudo elements like ::before and ::after will keep your styled hyperlink aligned with its visible shape.

Here’s a CSS heart shape that does not rely on transparent borders. You can see how the the red heart shape is the only clickable area of the element.

See the Pen
Clickable heart
by Bailey Jones (@bailey_jones)
on CodePen.

Here’s another example that creates a CSS triangle shape using transparent borders. You can see how the click area winds up being outside the actual shape. Hover over the element and you’ll be able to see the true size of the click area.

See the Pen
clickable triangle
by Bailey Jones (@bailey_jones)
on CodePen.


Hopefully this gives you a good baseline understanding of the many ways to create clickable regions on images and shapes, relying on HTML and CSS alone. You may find that it’s necessary to reach for JavaScript in order to get a more advanced interactive experience. However, the combined powers of HTML, CSS, and SVG provide considerable options for controlling the precise shape of your click target.

The post The Many Ways to Link Up Shapes and Images with HTML and CSS appeared first on CSS-Tricks.

Link Underlines That Animate Into Block Backgrounds

It's a cool little effect. The default link style has an underline (which is a good idea) and then on :hover you see the underline essentially thicken up turning into almost what it would have looked liked if you used a background-color on the link instead.

Here's an example of the effect on the Superfriendly site:

A journey:

  • The Superfriendly site does it with box-shadow. Turning box-shadow: inset 0 -0.07em 0 #0078d6; into box-shadow: inset 0 -0.85em 0 #a2d5fe; with a transition. Andres Cuervo ported that idea to a Pen. (I forked it to fix the "start offset" idea that was broken-seeming to me on the original).
  • You might be tempted to draw the line with a pseudo-element that's, say, absolutely positioned within the relatively positioned link. Then you animate its height or scaleY or something. Here's that kind of idea. Your enemy here is going to be links that break onto new lines, which box-shadow seems to handle more elegantly.
  • Another idea would be using linear-gradient with hard color stops to kinda "fake" the drawing of a line that's positioned to look like an underline. Then the gradient can be animated to cover the element on hover, probably by moving its background-position. Here's that kind of idea and another example we wrote up a little while back. This handles line breaks nicer than the previous method.
  • The default text-decoration: underline; has a distinct advantage these days: text-decoration-skip-ink! It has become the default behavior for links to have the underlines deftly skip around the decenders in text, making for much nicer looking underlines than any of these techniques (also: borders) can pull off. There are properties that are somewhat new that you may not be aware of that give you more control over the underline that we have traditionally had, like text-decoration-color. But there is more, like thickness and offset, that make this effect possible! Miriam Suzanne has a demo of exactly this, which only works in Firefox Nightly at the moment, but should be making the rounds soon enough.

Summary: If you need to do this effect right now in the most browsers you can, the box-shadow technique is probably best. If it's just an enhancement that can wait a bit, using text-decoration-thickness / text-decoration-offset / text-decoration-color with a transition is a better option for aesthetics, control, and being able to understand the code at first glance.

The post Link Underlines That Animate Into Block Backgrounds appeared first on CSS-Tricks.

Video Course: WordPress on Shared Hosting

This Summer I had the opportunity to record a new video course for LinkedIn/Lynda.com. The course walks through the process of installing and running WordPress on a shared hosting account. It's very straightforward and kept as simple as possible, recommended for anyone who wants to get a new WordPress site up and running as quickly and inexpensively as possible. You can find the course at both LinkedIn and Lynda.com.

Direct link to article | View post at DigWP.com

This Week in Spring: Spring Tutorials, Podcasts, News, and More

This week holds a lot of exciting new tutorials and releases in Spring

Hi, Spring fans! Welcome to another installment of This Week in Spring! We've just finished celebrating Labor Day here in the Long home, in San Francisco, USA. It was a fun day spent with family and friends, and I wasn't sure if I could have any more fun this week, but it's Tuesday, and you know what that means: another epic installment of This Week in Spring.

You may also like: A Guide to the Spring Framework's Annotations

I can't believe we're already in September, staring down the last few months of the year already! As usual, one of my favorite parts of the journey to the next year is the arrival of the epic SpringOne Platform show. This year is no different: I can't wait to celebrate the show with friends in epic Austin, TX. Will you be there? Let me know!

Styling Links with Real Underlines

Before we come to how to style underlines, we should answer the question: should we underline?

In graphic design, underlines are generally seen as unsophisticated. There are nicer ways to draw emphasis, to establish hierarchy, and to demarcate titles.

That’s clear in this advice from Butterick’s "Practical Typography":

If you feel the urge to underline, use bold or italic instead. In special situations, like headings, you can also consider using all caps, small caps, or changing the point size. Not convinced? I invite you to find a book, newspaper, or magazine that underlines text. That look is mostly associated with supermarket tabloids.

But the web is different. Hyperlinks are the defining feature of the internet; and from the internet’s inception, they have been underlined. It’s a universally understood convention. The meaning is crystal clear — an underline means a link.

However, plenty of popular websites have ditched underlines: The New York Times, New York Magazine, The Washington Post, Bloomberg, Amazon, Apple, GitHub, Twitter, Wikipedia. When they removed underlines from their search results page in 2014, Google lead designer Jon Wiley argued that it created a cleaner look. Notably though, the majority of these sites have kept slight variances on the traditional lurid blue color (#0000EE) that’s been the browser default since the beginning of the web. While this provides a visual cue for the majority of users, it may not be enough to pass WCAG accessibility compliance.

Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element.
WCAG 2.1

WCAG do not strictly mandate using underlines for links, but it does recommend them. Color blind users need to be able to discern a link. You could differentiate them in other ways, such as with a bold font-weight. Or you could keep this long-established visual affordance. But if we’re going to use underlines, we want them to look nice. Marcin Wichary, a designer at Medium, described the perfect underline as:

[...] visible, but unobtrusive — allowing people to realize what’s clickable, but without drawing too much attention to itself. It should be positioned at just the right distance from the text, sitting comfortably behind it for when descenders want to occupy the same space.

Achieving this has traditionally required CSS tricks.

The hacks we’ve had

This is one trick all developers will be familiar with: border-bottom. By emulating an underline using border-bottom, we gain control over color and thickness. These pseudo-underlines have one problem: an overly large distance from the text. They are underneath the descenders of the letters. You could potentially solve this issue by using line-height, but that comes with its own issues. A similar technique utilises box-shadow. Marcin Wichary pioneered the most sophisticated technique, using background-image to simulate an underline. They were useful hacks but are thankfully no longer needed.

Styling real underlines

Finally we can demarcate links without sacrificing style thanks to two new CSS properties.

  • text-underline-offset controls the position of the underline.
  • text-decoration-thickness controls the thickness of underlines, as well as overlines, and line-throughs.

According to the WebKit blog:

You can also specify from-font to both of these properties which will pull the relevant metric from the used font file itself.

UX agency Clearleft make bold use of (pseudo) underlines, calling clear attention to links with colorful styling. Here’s one example of a faux underline:

a {
  text-decoration: none;
  border-bottom: #EA215A 0.125em solid;
}

Notice that this fake underline is clearly below the descender of the letter "y":

Here’s the same paragraph, using DevTools to apply the same styling to a real underline using the new CSS properties:

a {
  text-decoration-color: #EA215A;
  text-decoration-thickness: .125em;
  text-underline-offset: 1.5px;
}

You’ll notice I’m using the em unit in my example code. The spec strongly encourages using it rather than pixels so that the thickness scales with the font.

These properties have already shipped in Safari and are coming in Firefox 70.

With the move to Chromium for Microsoft’s Edge browser, we will finally have cross browser support for the text-decoration-style property, which offers the options: solid (the default), double, dotted, dashed, and wavy. When combined, these new properties open up a whole range of possibilities.

Perhaps the biggest upgrade for underlines on the web, however, has come without developers needing to do anything. In the bad old days, descenders were unceremoniously sliced through by underlines, which was far from elegant. Developers used to hack around this shortcoming by applying a text-shadow that matched the background color. text-decoration-skip-ink brought a better way to make space for descenders.

The default value of auto (left) and a value of none (right)

Handily, it’s set as the new default value for underlines; meaning the look of underlines has improved while most web developers remain unaware that this property exists. Should you want an underline to cross over glyphs, you can set this property to none.

The post Styling Links with Real Underlines appeared first on CSS-Tricks.

This Week in Spring: Goodbye, Spring Boot 1.x

Hi, Spring fans! Welcome to another amazing week in Spring! The biggest headline this week: Spring Boot 2.2.0 M5 is available now as well as Spring Boot 2.1.7. The time has come — goodbye, Spring Boot 1.x!

This Week in Spring: Cloud, New Releases, and Java 13 Support

Hi, Spring fans! Welcome to another installment of This Week in Spring. This week, I’m in sweet San Francisco, soaking up the sun and enjoying the fun of summer. Sure, I’ve got a few meetings, and appearances, etc., but it is very nice to be home. By the way, I’ll be speaking at the upcoming San Francisco Java User Group — come hang out and say hi!

Anyway, lots of good stuff (as usual), so let’s get to it.

This Week in Spring: Releases, Events, Podcasts, and More

Hi, Spring fans! Welcome to another installment of This Week in Spring! I've just returned from Medellín, Columbia, yesterday, and am now in sunny Chicago for the epic SpringOne Tour Chicago event. And tomorrow, it's off to Lima, Peru. It's figuring to be quite a week!

As usual, we've got a lot to get to, so let's do it!