Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 水平排列图像,但不在同一级别_Javascript_Html_Css_Css Float - Fatal编程技术网

Javascript 水平排列图像,但不在同一级别

Javascript 水平排列图像,但不在同一级别,javascript,html,css,css-float,Javascript,Html,Css,Css Float,我有以下部门: <div id="features"> <div class="wrapper"> <ul> <li class="feature-1"><a href="#"><img src="img/black/blackMainImg.jpg" height="400px" width="180px"></a></li>

我有以下部门:

<div id="features">
    <div class="wrapper">
        <ul>
            <li class="feature-1"><a href="#"><img      src="img/black/blackMainImg.jpg" height="400px" width="180px"></a></li>
            <li class="feature-2"><a href="#"><img src="img/blue/blueMainImg.jpg" height="400px" width="180px"></a></li>
            <li class="feature-3"><a href="#"><img src="img/green/greenMainImg.jpg" height="400px" width="180px"></a></li>
            <li class="feature-4"><a href="#"><img src="img/red/redMainImg.jpg" height="400px" width="180px"></a></li>
            <li class="feature-5"><a href="#"><img src="img/yellow/yellowMainImg.jpg"height="400px" width="180px"></a></li>
            <div class="clear"></div>
        </ul>
    </div>

我希望图像大小相同,但层次不同 我不能上传照片,但我附加了一个网页链接,这是一个很好的例子,我的意思
如果我没弄错你的问题,这是一种方法。

.ul{
显示器:flex;
}
李先生{
利润率:10px;
列表样式:无;
}
.李:第n个孩子(单数){
利润上限:50px!重要;
}


如果我没弄错你的问题,这是一种方法。

.ul{
显示器:flex;
}
李先生{
利润率:10px;
列表样式:无;
}
.李:第n个孩子(单数){
利润上限:50px!重要;
}


您可以这样解决:

.wrapper li {
    float: left; /* Puts them on the same row. */
    margin: 10px; /* Some space around them. */
    list-style: none; /* Remove the bullet point. */
}

/* Individual top margins for the different list items. */
li.feature-1 { margin-top: 20px; }
li.feature-2 { margin-top: 40px; }
li.feature-3 { margin-top:  0px; }
/* ...and so on... */

您也可以按照其他答案中的建议使用伪选择器,但它在IE 8及以下版本中不起作用(这不是一个大问题,但仍然如此)。

您可以这样解决它:

.wrapper li {
    float: left; /* Puts them on the same row. */
    margin: 10px; /* Some space around them. */
    list-style: none; /* Remove the bullet point. */
}

/* Individual top margins for the different list items. */
li.feature-1 { margin-top: 20px; }
li.feature-2 { margin-top: 40px; }
li.feature-3 { margin-top:  0px; }
/* ...and so on... */

您也可以按照其他答案中的建议使用伪选择器,但它在IE 8及以下版本中不起作用(这不是一个大问题,但仍然存在)。

我创建了一些类似的东西,但没有图像,因为我没有这些图像


#特点李{ 高度:400px; 背景:红色; 宽度:180px; 显示:块; 列表样式类型:无; 浮动:左; &:第n个子(2n+2){ 利润率:50px20px20px; } }

在SASS中完成的标记CSS

我创建了一些类似的东西,但是没有图像,因为我没有图像


#特点李{ 高度:400px; 背景:红色; 宽度:180px; 显示:块; 列表样式类型:无; 浮动:左; &:第n个子(2n+2){ 利润率:50px20px20px; } }

在SASS中标记CSS

要移动图片的自定义页边距?然后是针对小型设备的媒体查询?使用
margin
实现。请注意示例中使用的css属性:position:absolute;top:101px;尝试对您想要移动的图片使用相同的功能xx类自定义边距?然后是针对小型设备的媒体查询?使用
margin
实现。请注意示例中使用的css属性:position:absolute;top:101px;尝试对您的feature xx类使用相同的功能