You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

按钮内添加小字体注释的排版问题求助

解决方案

问题出在.kafelek的flex布局默认是横向排列,导致注释和主文本在同一行。只需调整flex方向并给注释设置合适样式即可解决:

修改后的CSS代码

.kafelek {
    background-color: #C3CECB;
    border-radius: 5px;
    text-align: center;
    width: 230px;
    height: 100px;
    font-family: 'Open Sans';
    font-size: 20px;
    color: #003C3D;
    margin: 15px 10px 1px 0;
    display: flex;
    /* 改为纵向排列子元素 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 增加内边距避免文本贴边 */
    padding: 0 10px;
}

.kafelek:nth-child(5) {
    margin-right: 150px !important;
}

.kafelek:nth-child(6) {
    margin-left: 150px !important;
}

.kafelek:hover {
    border: 2px solid #7EDF00;
    transition: 0.3s;
    cursor: pointer;
}

/* 注释样式 */
.smallannot {
    font-size: 12px;
    /* 增加和主文本的间距 */
    margin-top: 5px;
    color: #003C3D;
}

修改后的HTML代码

<div class="kafelek">
    COMING SOON
    <div class="smallannot">(Annotation)</div>
</div>

关键修改点

  • 给.kafelek添加flex-direction: column,让内部元素纵向排列,注释自然跑到主文本下方
  • 给.smallannot设置小字号和顶部间距,区分主文本和注释
  • 给.kafelek增加左右内边距,避免文本在按钮边缘挤在一起

内容的提问来源于stack exchange,提问作者FrancisPhant0m

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 07:32:57