html - 如何调整列表样式图像的大小?

标签 html css html-lists photoshop

只是通过重新创建 tumblr 网站来做一些练习,我在显示“推荐的博客”的右侧遇到了一些问题。我想实现使用小用户图标 Logo 而不是列表样式元素符号。是否可以在 css 中调整图像的大小?还是我必须在 photoshop 中调整图像的大小?

看看My Code pen

HTML

<html>
<head>
    <title>Tumblr</title>
    <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
    <link rel="stylesheet" type="text/css" href="tumblrstyle.css">
</head>
<body>
<!-- Header Navigation  -->
    <div class="top-head">
        <header>
            <div id="top-head-left">
                <h1>T</h1>
                <input type="text" name="" placeholder="">
                <i class="fas fa-search"></i>
            </div>
            <div id="top-head-right">       
                <a href="#"><i class="fas fa-home fa-2x"></i></a>
                <a href="#"><i class="far fa-compass fa-2x"></i></a>
                <a href="#"><i class="fas fa-envelope fa-2x"></i></a>
                <a href="#"><i class="far fa-comment fa-2x"></i></a>
                <a href="#"><i class="fas fa-bolt fa-2x"></i></a>
                <a href="#"><i class="fas fa-user fa-2x"></i></a>
            </div>
        </header>
    </div>
<!-- End Header -->

<!-- RightBar -->
<div class="container">
    <div class="right-side">
            <div class="right-side nav">
                <h3>Recommended Blogs</h3>
                <ul id="navi">
                    <li>empty</li>
                    <li>empty</li>
                    <li>empty</li>
                    <li>empty</li>
                </ul>
            </div>
            <div class="radar">
                <h3>radar</h3>
                <ul>
                    <li>empty</li>
                    <p>

                    </p>
                </ul>
            </div>
    </div>

<!-- Post Controls -->
    <div class="controller">
            <a href="#"><img src="https://image.freepik.com/free-vector/abstract-summer-sun-logo-   design_1436-184.jpg"></a>
            <div class="post-group">
                <div class="icons">
                    <a href="#"><i class="fas fa-home fa-5x"></i></a>
                </div>
                <div class="icons">
                    <a href="#"><i class="far fa-compass fa-5x"></i></a>
                </div>
                <div class="icons">
                    <a href="#"><i class="fas fa-envelope fa-5x"></i></a>
                </div>
                <div class="icons">
                    <a href="#"><i class="far fa-comment fa-5x"></i></a>
                </div>
                <div class="icons">
                    <a href="#"><i class="fas fa-bolt fa-5x"></i></a>
                </div>
                <div class="icons">
                    <a href="#"><i class="fas fa-user fa-5x"></i></a>
                </div>
        </div>
    </div>
</body>
</html>

CSS

/*Reset*/

* {
    margin: 0;
    padding: 0;
}

body {
    background: lightgray;
}

header {
    padding: 0 10px;
}

header h1 {
    display: inline;
    margin-right: 15px;
}

.container {
    width: 60%;
    margin: auto;
    overflow: visible;
}

div h3 {
  border-bottom: 1px solid black;
}

/*Header*/

.top-head {
    background: lightblue;
    height: 60px;
    border-bottom: 5px solid black;
    padding: 0px 20px;
}


#top-head-left {
    float: left;
    padding-top: 5px;
}

#top-head-left input[type="text"] {
    width: 200px;
    background: yellow;
    padding: 5px 0px;
}

#top-head-right {
    float: right;
    padding-top: 12px;
}
/*RightsideBar*/

.right-side {
    float: right;
}

.nav ul {
    list-style-image: url('https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj');
}

.nav ul li {

}

.radar ul {
    list-style: none;
}
/*Post Controller*/
.controller {
    margin-top: 50px;
}


.controller img {
    width: 10%;
    float: left;
    margin-right: 20px;
    border-radius: 10px;
}


.post-group {
    float: left;
    background: white;
    height: 68px;
    border-radius: 10px;
    padding-top: 8px;
    padding-bottom: 22px;
}


.icons {
    float: left;
}

.icons a {
    color: orange;
    padding: 0 12px;
}

/* https://78.media.tumblr.com/avatar_3aed9115be2f_128.pnj
https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj
https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj
https://78.media.tumblr.com/avatar_996dede0302e_128.pnj */

最佳答案

#navi {
    list-style-type: none;
}

#navi > li::before {   
    content: '';   
    display: inline-block;   
    height: 40px;   
    width: 40px;    
    background-size: 40px;   
    background-image: url('https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj'); 
    background-repeat: no-repeat;   
    margin-right: 10px;
    background-position: center center;
    vertical-align: middle;
}

请不要介意我的选择器

关于html - 如何调整列表样式图像的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48956680/

相关文章:

php - 使用 Jquery 显示上传传输时间?

html - 一个下拉菜单来统治他们

html - 子菜单的下拉菜单位置

javascript - IOS 滚动站点修复

html - 来自 background-image 属性的 CSS 宽度和高度属性

css - IE7 中的错误 - body -direction :rtl

html - 保留面包屑元素的颜色点击

javascript - yAxis 数据在右侧定位时溢出到图表上

html - CSS 在中间垂直对齐 LI

css - Safari 中的框大小不规则