Breakout Buttons
source link: https://www.tuicool.com/articles/EBf2qim
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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
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
by Chris Coyier ( @chriscoyier
)
on CodePen .
Recommend
-
64
5 most popular breakout sessions from Google Cloud Next ‘18 (according to YouTube) 2018-09-19admin
-
33
Kotlin wins Breakout Project of the Year award at OSCON ’19 ...
-
45
Kotlin named Breakout Project of the Year at OSCON 2019...
-
53
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 enti...
-
9
Lattice HX4K FPGA Breakout
-
4
Breakout assets of 2020 Asset Store Team, December 16, 2020 ...
-
4
2020 Was a Breakout Year for CrisprBetween glimpses of a medical cure and winning science’s shiniest prize, this proved to the gene-editing technology’s biggest year yet.
-
1
Configuring CML-P Breakout Tool for MacOS May 31, 2020 By Rowell Leave a Comment ...
-
7
Microsoft Teams Breakout Rooms is getting new features! + other roadmap updates When looking at Microsoft Teams roadmap today I noticed that Breakout Rooms is getting new features! Scheduled to roll out already in this mo...
-
3
The breakout of the stock market to record highs is being affirmed by one of the oldest indicators on Wall StreetSpencer Platt/Get...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK