将<a>标记移动到没有<br>的新行

Ase*_*sez 0 html css css3

我想在<a>不使用的情况下将每个移动到一个新行<br>.

<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)

G-C*_*Cyr 5

您需要将显示重置为块级别值,或者浮动并清除或重置BFC并调整其大小.

有很多方法,只需使用最符合您需求的方法:

a {display:block;background:grey}
Run Code Online (Sandbox Code Playgroud)
<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)

a {display:table;background:gray}
Run Code Online (Sandbox Code Playgroud)
<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)
柔性 ?

a {display:flex;background:gray}
Run Code Online (Sandbox Code Playgroud)
<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)
或漂浮和清除

a {float:left;clear:left;background:gray}
Run Code Online (Sandbox Code Playgroud)
<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)

甚至内联块+宽度

a {display:inline-block;width:100%;background:gray}
Run Code Online (Sandbox Code Playgroud)
<div class="redirects">
    <a href="http://google.com">1</a>
    <a href="http://google.com">2</a>
    <a href="http://google.com">3</a>
</div>
Run Code Online (Sandbox Code Playgroud)