简体   繁体   English

样式A <li> 元件

[英]Style a <li> element

I'm trying to make a list of music-elements with their picture and their description for mobile usage. 我正在尝试列出音乐元素及其图片和手机使用说明。 As I have to work with Responsive Design I implemented Foundation but now if I want to make up a < li > item he can't find the right CSS so I tried to put numbers in front of the css-file names in order to manipulate the sequence he uses to put the styles on the elements, my code goes something like this: 因为我必须使用响应式设计,所以我实现了Foundation,但是现在如果我想组成一个<li>项目,他找不到正确的CSS,所以我尝试将数字放在css文件名之前以进行操作他用来将样式放在元素上的顺序,我的代码如下所示:

Mainpage: 主页:

<ul class="small-block-grid-3 large-block-grid-6">
    <li class="spotsList">
        <div class="spotsDiv">
            <img src="Images/PlayIcon.png" style="width: 50px; height: 50px; float:left"/>
            <article>
                <b>Spotnaam: <asp:Label ID="lblNaam" runat="server" Text="Duvel forever"></asp:Label></b>
                <br/> 
                Spotnr: <asp:Label ID="lblnr" runat="server" Text="049345679"></asp:Label>
            </article>
        </div> 
    </li>

    <li class="spotsList">
        <div class="spotsDiv">
            <img src="Images/PlayIcon.png" style="width: 50px; height: 50px; float:left"/>
            <article>
                <b>Spotnaam: <asp:Label ID="Label1" runat="server" Text="Duvel always"></asp:Label></b>
                <br/> 
                Spotnr: <asp:Label ID="Label2" runat="server" Text="049345679"></asp:Label>
            </article>
        </div> 
    </li>
</ul>

and my CSS goes like this: 我的CSS像这样:

/*Layout Divs for spots*/
.spotsDiv {
    height: 56px;
    width: 400px;
}

/*Layout li items*/
.spotsList {
    width: 400px; 
    margin-right: 10px; 
    margin-bottom:5px; 
    border-bottom: 1px solid black;
}

Should I use another way of styling or is there another way to choose the order of css that gets implemented? 我应该使用另一种样式设置还是有另一种方法选择要实现的CSS顺序? Any suggestions? 有什么建议么?

You don't need numbers for ordering your CSS files. 您不需要数字来订购CSS文件。 The order styles are loaded is the order of appearance in your HTML. 加载的样式是HTML中外观的顺序。

Order would be 1, 2, 3: 顺序为1、2、3:

...
<link rel="stylesheet" type="text/css" href="1.css">
<link rel="stylesheet" type="text/css" href="2.css">
<link rel="stylesheet" type="text/css" href="3.css">
...

Order would be 2, 3, 1: 顺序为2、3、1:

...
<link rel="stylesheet" type="text/css" href="2.css">
<link rel="stylesheet" type="text/css" href="3.css">
<link rel="stylesheet" type="text/css" href="1.css">
...

Style that are loaded at the end, overwrites styles from before (if they have the same specificity http://css-tricks.com/specifics-on-css-specificity/ ). 最后加载的样式会覆盖之前的样式(如果它们具有相同的特殊性http://css-tricks.com/specifics-on-css-specificity/ )。

As I can see in your example, the guy is just using an image, you can try to do this: 正如我在您的示例中看到的那样,该家伙只是在使用图像,您可以尝试执行以下操作:

http://jsfiddle.net/Ltr8r/ http://jsfiddle.net/Ltr8r/

You have to display an image instead of the list style default ! 您必须显示图像而不是默认的列表样式!

 list-style-type: none;
 background-image: url(Images/PlayIcon.png);

if it's just a CSS problem, you have to put your own css BEFORE all the other ;-) 如果只是CSS问题,则必须在所有其他CSS之前放自己的CSS ;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM