小编use*_*661的帖子

灵活的缩略图网格与CSS

我试图在屏幕上放置缩略图,甚至是"填充".这是一个说明问题的图像:

页面预览

<!DOCTYPE html>
<html>
<head>
<title>Test rows</title>

<style type="text/css">

    body {
        background: #121212;
        color: #fff;
    }

    #Container {
        background: #585858;
        margin: 0 auto;
        min-width: 1024px;
        width: 85%;
        margin-top: 50px;

        text-align: justify;
        -ms-text-justify: distribute-all-lines;
        text-justify: distribute-all-lines;
    }

    #Container a {
        vertical-align: top;
        display: inline-block;
        *display: inline;
        zoom: 1;
    }

    .stretch {
        width: 100%;
        display: inline-block;
        font-size: 0;
        line-height: 0;
    }




</style>
</head>

<body>

<div id="Container">

<a href="#"><img src="http://dummyimage.com/200x120/444/fff" /></a>
<a href="#"><img src="http://dummyimage.com/200x120/444/fff" /></a>
<a href="#"><img src="http://dummyimage.com/200x120/444/fff" /></a>
<a href="#"><img src="http://dummyimage.com/200x120/444/fff" /></a> …
Run Code Online (Sandbox Code Playgroud)

html css

9
推荐指数
1
解决办法
5682
查看次数

Python:将循环与列表相关联

我找不到任何解决方法.在我的实例中,这将用于将颜色遮罩与对象相关联.

我认为最好的解释方法是举个例子:

objects = ['pencil','pen','keyboard','table','phone']
colors  = ['red','green','blue']

for n, i in enumerate(objects):
    print n,i #0 pencil

    # print the index of colors
Run Code Online (Sandbox Code Playgroud)

我需要的结果:

#0 pencil    # 0 red
#1 pen       # 1 green
#2 keyboard  # 2 blue
#3 table     # 0 red
#4 phone     # 1 green
Run Code Online (Sandbox Code Playgroud)

因此,总会有3种颜色与对象相关联,如何for在python循环中获得此结果?每次n(迭代器)大于颜色列表的长度时,如何告诉它返回并打印第一个索引,依此类推?

python loops for-loop list

3
推荐指数
1
解决办法
128
查看次数

将图标放在文本 css 之后

我需要在段落之后放置一个呈现图标的 i 元素,但是当我使用伪元素“after”时,我只会得到纯 html 而不是图标。如何获得图标渲染而不是 html 文本?谢谢你。

.myDiv p:after {

    content: '<i class="towerIcon"></i>';
}
Run Code Online (Sandbox Code Playgroud)

结果

Lorem ipsum dolor sit amet, consectetur adipiscing<i class="towerIcon"></i>
Run Code Online (Sandbox Code Playgroud)

html css

-2
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×2

html ×2

for-loop ×1

list ×1

loops ×1

python ×1