简体   繁体   English

带有填充的HTML列表,试图弄清楚包装

[英]HTML List with padding, trying to figure out wrapping

So I'm having trouble with a link section. 所以我在链接部分遇到了麻烦。 I've got big blocks for links. 我有很大的链接块。 When the viewport is wider, they all line up next to each other. 当视口变宽时,它们彼此并排排列。 But I've got a tiny bit of responsive space where I want the block that says MOBOT to knock down onto a new line. 但是我有一点点的响应空间,我希望显示MOBOT的代码段能够进入新的一行。

http://www.contrib.andrew.cmu.edu/~sc0v/secret/images/current.png http://www.contrib.andrew.cmu.edu/~sc0v/secret/images/current.png

My goal is that the MOBOT square clears the first line of squares completely. 我的目标是使MOBOT方块完全清除方块的第一行。 So like the link below Apologies for the hack together illustrator screenshot. 因此,就像下面的“道歉,一起破解illustrator屏幕截图”链接。

http://www.contrib.andrew.cmu.edu/~sc0v/secret/images/ideal.png http://www.contrib.andrew.cmu.edu/~sc0v/secret/images/ideal.png

My html: 我的html:

    <h4 class="sub-head-top">Quick Links</h2>
    <ul class="traditions"> 
        <a href="#booth"><li class="quicklink">Booth</li></a>
        <a href="#buggy"><li class="quicklink">Buggy</li></a>
        <a class="last" href="#mobot"><li class="quicklink">Mobot</li></a>
    </ul>

My css: 我的CSS:

    ul.traditions {
        padding-top:12px;
        padding-bottom:10px;
    }

    ul.traditions li {
        display: inline;
        list-style:none;
         }

    ul.traditions li.quicklink   {
        background-color:#37BEEC;
        font-family:'Montserrat', Arial, Helvetica;
        text-transform:uppercase;
        font-size:.8em;
        letter-spacing:.1em;
        color:white;
        font-weight:bold;
        padding:15px 18px;
        text-decoration: none;
    }

    ul.traditions a   {
        color:white;
        text-decoration: none;
        margin:0px 13px 0px 0;
    }

    ul.traditions a.last   {
        margin:0 0px 0px 0;
    }

Any thoughts on where I should put padding/margins or something else that is wrong with my code? 关于我应该在哪里放置填充/边距或其他我的代码有问题的想法? I'm a designer by trade, so my coding knowledge is hacked together, just let me know if it's off! 我是一名行业设计师,所以我的编码知识被黑了,请告诉我它是否已关闭!

Thanks!! 谢谢!! :) :)

Syntax error - You can not have an elemnt within an <ul> unless it is wrapped in a <li> . 语法错误- <ul>不能包含元素,除非将其包装在<li> You have <a> wrapping <li> this is not correct. 您有<a>包装<li>这是不正确的。 Also you have a <h4> opening tag and a <h2> closing tag. 另外,您还有<h4>开头标签和<h2>结束标签。

DEMO http://jsfiddle.net/x8dSP/2624/ 演示http://jsfiddle.net/x8dSP/2624/

<h4 class="sub-head-top">Quick Links</h4>
    <ul class="traditions"> 
       <li class="quicklink"><a href="#booth">Booth</a></li>
        <li class="quicklink"><a href="#booth">Booth</a></li>
        <li class="quicklink last"><a href="#booth">Booth</a></li>
    </ul>

Change your ul.traditions li CSS to the following: 将您的ul.traditions li CSS更改为以下内容:

CSS CSS

ul.traditions li {
    display: inline-block;
    list-style:none;
    margin-bottom: 15px;
}

You want to set the li elements as inline-block and set the bottom margin to normalize the spacing. 您希望将li元素设置为inline-block并设置底部页边距以规范化间距。

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

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