最初,我努力地绕过基本方格模式的角落。 Then, I remembered the versatility of the bullet point glyph (✦) and realized that overlaying it on each intersection could create the desired rounded effect.
Let's begin with the fundamental checkered pattern:
<div></div>
div { background: repeating-linear-gradient( to right, transparent, transparent 50px, white 50px, white 55px),重复线性毕业生(底部,透明,透明50px,白色50px,白色55px),线性级别(45DEG,PINK,SKYBLUE); / *更多样式 */}
此代码生成了正方形的重复模式,从粉红色到天蓝,具有5px白色间隙。 重复线性级别
函数会创建水平和垂直白色条纹,在分层时,会形成棋盘。 The third gradient provides the color fill.
To add the rounded corners, we overlay the bullet point glyph using an encoded SVG:
div { background: repeat left -17px top -22px/55px 55px url("data:image/svg xml,<svg viewbox="'0" xmlns="'http://www.w3.org/2000/svg'"> <foreferobject height="'35px'width"> <div style="max-width:90%";" xmlns="'http://www.w3.org/1999/xhtml'">✦</div> </foreferobject></svg> “),重复单线级别(右) 50px,白色55px),线性毕业生(45DEG,粉红色,Skyblue); / *更多样式 */}
重复
关键字指示重复背景图像。 左-17PX TOP -22PX/55PX 55PX
设置每个重复单元的位置和大小,仔细偏移以与网格交叉点保持一致。 SVG包含HTML <div> 显示字形的元素;它的<code>字体大小
直接影响正方形的角半径。扩展的SVG看起来像这样:
<svg viewbox="“" xmlns="“" http:> <firedobject> <firceobject> <firceobject height="“" width> <div style="”" xmlns="http://www.w3.org/1999/xhtml">✦</div></firceobject></firceobject></firedobject></svg>
Finally, let's add a hover effect:
div:hover { background: repeating-linear-gradient( to right, transparent, transparent 50px, rgb(255 255 255 / 0.5)50px,RGB(255 255 255 / 0.5)55px),重复线性级别(底部,透明,透明,透明50px,RGB(255 255 255 / 0.5)(255 255 / 0.5)50px,RGB,RGB(255 255 255 / 0.5 / 0.5),555 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5 / 0.5),线性 - 线性词(455级,粉色)盒子阴影:10px 10px 20px粉红色; }
这将悬停在悬停上的字形,并使用 rgb()
使用alpha透明度使白线半透明剂。 box shadow
添加了微妙的效果。
该技术提供了一种具有CSS的圆形棋盘棋盘图案的创造性和有效方法,为各种交互式风格提供了灵活性。我欢迎评论中的其他方法!
以上是CSS棋盘背景...但是具有圆角和悬停样式的详细内容。更多信息请关注PHP中文网其他相关文章!