简体   繁体   English

为什么我的锚标签没有重排?

[英]Why aren't my anchor tags reflowing?

I'm working on my new website and am running into something I just can't figure out. 我正在我的新网站上工作,并且遇到了一些我无法弄清的事情。 Here's the link: 这里是链接:

http://www.adamabrams.com/aadc/ http://www.adamabrams.com/aadc/

When I resize my browser to "mobile width", so that it's narrower than the width of the little row of oval "Tags" just below my site menu, I want the tags to reflow into two rows (or as many as needed). 当我将浏览器的大小调整为“移动宽度”,以使其比我的网站菜单正下方的一排椭圆形“标签”的宽度窄时,我希望标签重排为两行(或根据需要排列)。 Instead, they stubbornly remain in a single row and jut off the right side of the window. 相反,它们固执地停留在单行中并突出于窗口的右侧。

I haven't given the enclosing div a fixed height... I know this must be something simple, but I'm stumped! 我没有给封闭的div设置固定的高度...我知道这一定很简单,但是我很困惑!

Here's the HTML: 这是HTML:

<main class="content" itemtype="http://schema.org/Blog" itemscope="itemscope" itemprop="mainContentOfPage" role="main">
<div class="post_tags">
<a class="tagintro" href="#">Select area of expertise:</a>
<a class="database" title="database projects" href="http://adamabrams.com/aadc/tag/database/">database</a>
<a class="ecommerce" title="ecommerce projects" href="http://adamabrams.com/aadc/tag/ecommerce/">ecommerce</a>
<a class="mobile" title="mobile projects" href="http://adamabrams.com/aadc/tag/mobile/">mobile</a>
<a class="website" title="website projects" href="http://adamabrams.com/aadc/tag/website/">website</a>
</div>

...and here's all the CSS that relates, I think: ...这是所有相关的CSS,我认为:

/* TAG BUTTONS */

/* Styling of the buttons, everywhere */
.entry-tags a, .post_tags a {
    color: #3D3D3D;
    font-weight: bold;
    background-color: #EECE88;
    padding: .35em .5em;
    border-radius: .7em;
    -moz-border-radius: .7em;
    -webkit-border-radius: .7em;
}

.entry-tags a:hover, .post_tags a:hover {
    color: black;
    background-color: orange;
}

/* TAGS "HEADER" ON TAG.PHP PAGE */

/* Layout of buttons area */
.post_tags {
    text-align: center;
    margin-bottom: 2em;
}

/* Spacing between buttons */
.post_tags a {
    margin-right: 1em;
}

.post_tags a:first-child,
.post_tags a:last-child {
    margin-right: 0;
}

/* Currently displayed tag */
body.tag-ecommerce a.ecommerce,
body.tag-database a.database,
body.tag-mobile a.mobile,
body.tag-website a.website {
    color: black;
    background-color: orange;
}

a.tagintro, a.tagintro:hover {
    background-color: transparent;
    color: white;
}

Any ideas or suggestions are most welcome! 任何想法或建议都是最欢迎的!

Thanks, Adam 谢谢亚当

I see what you are going for. 我明白你要干什么。 The best way to get what you are trying to achieve is to change the width and margin of the element at the desired break-point. 获得要达到的目标的最佳方法是在所需的断点处更改元素的宽度和边距。

So for your "media width" you set your classes to re-size. 因此,对于您的“媒体宽度”,您可以将类别设置为重新调整大小。 By doing so the elements will flow naturally down the document. 这样,元素将自然地顺着文档流下。

ex: 例如:

 @media only screen and (max-width: 480px) { /* Your break-point for mobile */ .ecommerce, .database, .mobile, .website{ width: 48%; margin-left: 1%; margin-right: 1%; } } 

Or some similar measurements that makes sense with your design. 或一些对您的设计有意义的类似测量。

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

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