css < br>或< /br>在边界内不起作用

anauzrmj  于 2023-04-08  发布在  其他
关注(0)|答案(2)|浏览(229)

我只是想问一下如何在边框内的这些按钮之间添加空间,因为
或者在html中不起作用。下面的Html代码:

<div class="container2">
    <button class="accordion">What is an alumni website?</button>
    <div class="panel">
        <p1>An alumni website is a platform designed for graduates of a specific educational institution to connect and engage with one another. It provides a space for alumni to stay in touch, share news, and participate in events and programs organized by the institution.</p1>
    </div>
    <button class="accordion">Who can access an alumni website?</button>
    <div class="panel">
        <p1>Typically, alumni websites are only accessible to graduates of the specific educational institution. In some cases, access may also be granted to current students, faculty members, and staff of the institution.</p1>
    </div>
    <button class="accordion">What are the benefits of joining an alumni website?</button>
    <div class="panel">
        <p1>Joining an alumni website can provide a range of benefits, including the ability to network with other graduates, stay informed about news and events related to the institution, access career resources and job postings, and participate in mentoring or volunteer programs.</p1>
    </div>

我只是也放弃了输出。我尝试了<br></br>标记,但它不工作。

owfi6suc

owfi6suc1#

您可以通过添加边距或填充来完成此操作。
您还可以通过添加以下内容来为所有按钮实现此功能

button.accordion {
    margin-bottom: 0.5rem;
}

到页面的css样式表

egdjgwm8

egdjgwm82#

我真的不推荐<br>,使用CSS margins更容易,更灵活。
示例:

button.accordion{
     margin: 10px 0;
}

相关问题