div:nth-child(1),div:nth-child(6),div:nth-child(11) { box-shadow: -70px -70px 0 -67px red, 70px 70px 0 -67px red; } div:nth-child(1):hover,div:nth-child(6):hover,div:nth-child(11):hover { box-shadow: -70px -70px 0 -67px red, 70px 70px 0 -67px red, 0 0 0 3px gold; } div:nth-child(2),div:nth-child(7),div:nth-child(12) { background: linear-gradient(#333, #333) no-repeat center, linear-gradient(to bottom right, red 20%, transparent 20%, transparent 80%, red 80%) no-repeat center ; background-size: auto auto, 200px 200px; } div:nth-child(2):hover, div:nth-child(7):hover,div:nth-child(12):hover { background: linear-gradient(#333, #333) no-repeat center, linear-gradient(to bottom right, red 20%, transparent 20%, transparent 80%, red 80%) no-repeat center, white; background-size: auto auto, 200px 200px; } div:nth-child(3),div:nth-child(8),div:nth-child(13) { border:none; padding:3px; background: linear-gradient(red,red) no-repeat top left, linear-gradient(red,red) no-repeat top left, linear-gradient(red,red) no-repeat bottom right, linear-gradient(red,red) no-repeat bottom right, linear-gradient(#333,#333) center no-repeat ; background-size: 40% 3px, 3px 40%, 40% 3px, 3px 40%, auto auto; background-clip: border-box, border-box, border-box, border-box, content-box; } div:nth-child(3):hover, div:nth-child(8):hover,div:nth-child(13):hover { border:none; padding:3px; background: linear-gradient(red,red) no-repeat top left, linear-gradient(red,red) no-repeat top left, linear-gradient(red,red) no-repeat bottom right, linear-gradient(red,red) no-repeat bottom right, linear-gradient(#333,#333) center no-repeat, green ; background-size: 40% 3px, 3px 40%, 40% 3px, 3px 40%, auto auto; background-clip: border-box, border-box, border-box, border-box, content-box; } div { width: 200px; height:200px; margin: 10px; background: #333; border: solid transparent; box-sizing: border-box; display:inline-flex; vertical-align:middle; flex-direction:column; align-items:center; justify-content:center; text-align:center; color:white; } hr~div { border-radius:5px; } hr~hr~div { border-radius:25px; } html { background:gray; text-align:center }
<div>red broken borders drawn via <code>shadow</code> </div> <div>red broken borders drawn via <code>linear­-gradient</code> </div> <div>red broken borders drawn via multiple <code>linear­-gradient</code> & <code>background­-clip, background­-size, background­-position</code> </div> <hr/> <p>Can a small <code>border-radius</code> be applied ?</p> <div>red broken borders drawn via <code>shadow</code> </div> <div>red broken borders drawn via <code>linear­-gradient</code> </div> <div>red broken borders drawn via multiple <code>linear­-gradient</code> & <code>background­-clip, background­-size, background­-position</code> </div> <hr/> <p>Can a big <code>border-radius</code> be applied ?</p> <div>red broken borders drawn via <code>shadow</code> </div> <div>red broken borders drawn via <code>linear­-gradient</code> </div> <div>red broken borders drawn via multiple <code>linear­-gradient</code> & <code>background­-clip, background­-size, background­-position</code> </div>