css图标 | 来自 fontawesome 字体文件的586 个小图标

1. css效果

/*!
 *  Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome
 *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
 */
 
.fa-glass:before {content:"\f000"}
.fa-music:before {content:"\f001"}
.fa-search:before {content:"\f002"}
.fa-envelope-o:before {content:"\f003"}
.fa-heart:before {content:"\f004"}

2. 使用py批量转换为html格式

# part I 转化一个
def toCss(str2):
    #str2='.fa-glass:before {content:"\f000"}'
    import re 
    arr = re.split(':', str2)[0]
    arr=arr[1:]
    return "" %(arr, arr)

# test
toCss('.fa-film:before {content:"\f008"}')
## ""


# part II 转换全部
fr = open("css.txt", 'r')
fw = open("index.html", 'w')
header="""




"""
fw.write(header + "\n")

i=0
while True:
    i +=1
    if i>10:
        #break
        pass
    lineR = fr.readline()
    if not lineR:
        break;
    line = lineR.strip()
    
    css = toCss(line)
    #print(i, line, css)
    fw.write(css + "\n")
fr.close()
fw.close()

print("end", i)
# 586 个小图标

3.效果图

css图标 | 来自 fontawesome 字体文件的586 个小图标_第1张图片
可以目测效果图,然后鼠标右击查看样式代码。

你可能感兴趣的:(可视化,html_css,css,前端)