puock主题朋友圈界面多图样式分享

2,947次阅读
没有评论

共计 2278 个字符,预计需要花费 6 分钟才能阅读完成。

具体展现效果可以参考动态页面,纯CSS代码完成。
代码如下:

#page-moments {
    --img-gap: 6px;
    --img-radius: 8px;
}
#page-moments .moment-content p:has(img) br {
    display: none !important;
    content: "" !important;
    height: 0 !important;
}
#page-moments .moment-content p:has(img) {
    font-size: 0 !important;
    line-height: 0 !important;
    display: block !important;
    margin: 0 0 1em 0 !important;
    padding: 0 !important;
}
#page-moments .moment-content p:has(img) > :not(img):not(br) {
    font-size: 16px !important;
    line-height: 1.6 !important;
    display: block !important;
    margin-bottom: 10px !important;
}
#page-moments .moment-content p:has(img) img {
    display: inline-block !important;
    vertical-align: top !important;
    border-radius: var(--img-radius) !important;
    object-fit: cover !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    margin-right: var(--img-gap) !important;
    margin-bottom: var(--img-gap) !important;
}
#page-moments .moment-content p:has(img) img:last-child {
    margin-right: 0 !important;
}
#page-moments .moment-content p:has(img) img:nth-last-child(-n+3) {
    margin-bottom: 0 !important;
}
#page-moments .moment-content p:has(img:only-child) img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 400px !important;
    margin: 0 auto !important;
    display: block !important;
}
#page-moments .moment-content p:has(img:nth-of-type(2):last-of-type) img {
    width: calc(50% - var(--img-gap)/2) !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#page-moments .moment-content p:has(img:nth-of-type(3):last-of-type) img {
    width: calc(33.333% - var(--img-gap)) !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#page-moments .moment-content p:has(img:nth-of-type(4):last-of-type) img {
    width: calc(50% - var(--img-gap)/2) !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#page-moments .moment-content p:has(img:nth-of-type(4):last-of-type) img:nth-of-type(2n) {
    margin-right: 0 !important;
}
#page-moments .moment-content p:has(img:nth-of-type(4):last-of-type) img:nth-of-type(n+3) {
    margin-bottom: 0 !important;
}
#page-moments .moment-content p:has(img:nth-of-type(n+5)) img {
    width: calc(33.333% - var(--img-gap)) !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#page-moments .moment-content p:has(img:nth-of-type(n+5)) img:nth-of-type(3n) {
    margin-right: 0 !important;
}
@media (max-width: 768px) {
    #page-moments .moment-content p:has(img:not(:only-child)) img {
        aspect-ratio: 1 !important;
        height: auto !important;
    }
}
正文完
 1
评论(没有评论)
验证码

没有人的日常

文章搜索
随机文章
反人类Win11之无法拖拽文件至任务栏软件的解决方法

反人类Win11之无法拖拽文件至任务栏软件的解决方法

1、按下快捷键win+r,输入:regedit 2、打开注册表之后依次展开:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System 3、在右边找到EnableLUA,双击之后就在弹出的窗口中将数据数值...
反人类Win11之文件右键菜单改回Win10

反人类Win11之文件右键菜单改回Win10

使用win11,最大的问题是什么,是右键菜单很多时候需要点两次,实在是反人类,太麻烦了。必须使用“显示更多选项”的右键菜单: 这个时候使用Shift + F10又很麻烦,远不如原来的快捷键来的舒服。那么,怎么回到win1...
备个份:WordPress代码子主题CSS覆盖问题

备个份:WordPress代码子主题CSS覆盖问题

之前用WordPress主题,开启子主题之后,CSS覆盖问题折腾我无数个难眠的夜。每次加body或者使用!important调整优先级真是麻烦!!!多谢群友提供的解决方案。以下代码放子主题function.php文件即可 //子主题目录ur...
备个份:PDF加盖骑缝章

备个份:PDF加盖骑缝章

软件简介:一款用于在PDF文件上加盖骑缝章的工具。支持导入完整的印章图片,并根据PDF的页数进行随机分割,还可以设定印章的大小和位置,最终生成带有骑缝章的PDF文件。
Win10和Win11设置开机默认开启数字小键盘

Win10和Win11设置开机默认开启数字小键盘

1、Win10 ①运行Win + R 组合键,打开 cmd,输入 regedit ,打开注册表编辑器。 ②在注册表编辑器中,依次展开 HKEY_USERS == 》 .DEFAULT ==》 Control Panel ==》 Keyboard ,点击 Keyboard 之后在右侧窗口中找到...
最新评论