请求修改GIF文件夹预览VBS脚本:文件名置于GIF下方并缩小字号
修改后的VBS脚本实现方案
直接调整原脚本的输出结构,就能实现文件名在GIF下方显示、缩小字号并让一行容纳更多GIF的需求:
<script type="text/vbs"> set fso=CreateObject("Scripting.FileSystemObject") set fldr=fso.GetFolder(".") for each file in fldr.files if lcase(right(file.name,4))=".gif" then ' 包裹每个GIF单元,实现横向排列 document.write "<div style='display: inline-block; text-align: center; margin: 6px;'>" document.write "<img src=""" & file.name & """>" ' 缩小字号并置于图片下方 document.write "<div style='font-size: 12px; margin-top: 3px;'>" & file.name & "</div>" document.write "</div>" end if next </script>
关键修改点:
- 用
display: inline-block的<div>作为每个GIF的容器,让多个GIF能在同一行横向排列,margin参数控制单元间的间距 - 给文件名单独设置一个
<div>,通过font-size: 12px缩小字号,margin-top拉开和图片的距离,text-align: center让文字和图片居中对齐 - 移除原脚本中多余的空格转义字符,改用容器间距优化布局
内容的提问来源于stack exchange,提问作者deiraf
相关产品推荐
相关产品推荐

