静态资源的简单使用

2018-12-27  本文已影响5人  求墨者

添加icon

icon快速制作 https://instafavicon.com/

<head>
    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>

添加图片

免费图片网站 https://unsplash.com/

<body>
    <img alt="Avatar" src="{{ url_for('static', filename='images/avatar.png') }}">
</body>

添加CSS

CSS布局快速入门
https://learnlayout.com/

<head>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" type="text/css">
</head>

static/style.css

/* 页面整体 */
body {
    margin: auto;
    max-width: 580px;
    font-size: 14px;
    font-family: Helvetica, Arial, sans-serif;
}

/* 页脚 */
footer {
    color: #888;
    margin-top: 15px;
    text-align: center;
    padding: 10px;
}

/* 列表 */
.software-list {
    list-style-type: none;
    padding: 0;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.software-list li {
    padding: 12px 24px;
    border-bottom: 1px solid #ddd;
}

.software-list li:last-child {
    border-bottom:none;
}

.software-list li:hover {
    background-color: #f8f9fa;
}

/* pug */
.pug {
    display: block;
    margin: 0 auto;
    height: 100px;
}
上一篇 下一篇

猜你喜欢

热点阅读