<li>元素中的像素行或列缺少颜色

时间:2018-11-30 09:33:47

标签: html-lists

我有几个包含文本的方形<li>元素。它们都具有相同的颜色。

我面临的问题是,在将框阴影应用到<li>元素后,我可以看到这些元素的边框上的一系列像素缺少所应用的颜色。下图所示-

pixels are not having color

代码-

HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Details of university project</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

    <div class="container">

        <div class="header">
            <h1>University Management</h1>
        </div>

        <div class="project-features">
            <h2>Project features</h2>
            <ul>
                <li><span>Flat UI </span></li>
                <li><span>Responsive </span></li>
                <li><span>PDF and Excel conversion </span></li>
                <li><span>Live Search </span></li>
            </ul>
            <ul>
                <li><span>Flat UI </span></li>
                <li><span>Responsive </span></li>
                <li><span>PDF and Excel conversion </span></li>
                <li><span>Live Search </span></li>
            </ul>
        </div>

    </div>

</body>
</html>

CSS:

.project-features {
    min-width: 300px;
    margin: 0 auto;
    display: block;
    text-align: center;
}

.project-features h2 {
    display: block;
    margin: 0;
    padding: 70px 0 50px 0;
    font-size: 150%;
    text-transform: uppercase;
}

.project-features ul {
    display: inline-block;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 80%;
    font-size: 0; /* For removing html whitespaces on inline-block elements */
}

.project-features ul:last-child {
    margin-top: 20px;
}

.project-features ul li {
    display: inline-block;
    position: relative;
    box-shadow: 0 0 10px 2px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #2980b9, #16a085);
    width: 22%;
    font-size: 18px; /* For removing html whitespaces on inline-block elements */
}

.project-features ul li:not(:first-child) {
    margin-left: 4%;
}

/* For making the box a square */
.project-features ul li:after {
    content: "";
    display: block;
    padding-top: 100%;
}

/* Text inside the box */
.project-features ul li span {
    position: absolute;
    display: block;
    width: 100%;
    text-align: center;
    color: #fff;
    top: 50%;
    transform: translate(0,-50%);
}

如果需要,请在Github中查看完整的实现:

https://shourovfoisal.github.io/University-Project/

任何帮助都会得到补偿。

0 个答案:

没有答案