Skip to content

[WIP] Fix card alignment issue with search box and navbar#4

Merged
LR1933 merged 1 commit intomainfrom
copilot/fix-card-alignment-issue
Feb 26, 2026
Merged

[WIP] Fix card alignment issue with search box and navbar#4
LR1933 merged 1 commit intomainfrom
copilot/fix-card-alignment-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

  • Replace assets/custom.css with padding-based approach for card section alignment
Original prompt

问题描述

卡片区(Finance, Travel, Tools, Researches, LLM)没有与上方搜索框/navbar 对齐,卡片从页面最左侧开始,而搜索框和 navbar 都在页面中央约 80% 宽度的范围内。

真实 DOM 结构(通过浏览器开发者工具确认)

#app
  #main-section.section
    div.container
      div  ← 裸 div,没有 class
        article.message   ← Google 搜索框
        div.columns.is-multiline.layout-vertical  ← 卡片区
          div.column.is-2-4
          div.column.is-2-4
          ...

根本原因

.container 里面还有一层<div>(无 class),卡片的 div.columns.is-multiline 在这个裸 div 里面。因此对 .container 设置 width: 80% 没有效果,因为 .columns 会撑满父级裸 div 的 100% 宽度。

需要做的修改

修改 assets/custom.css

将第 5 节(主内容卡片区)的规则完全替换为以下内容,使用 padding 方式而非 width 方式来收窄卡片区,与搜索框对齐:

完整的 custom.css 内容如下(完整替换整个文件):

@charset "UTF-8";

/* ============================================================
   目标布局:
   - 第一行:Beacon logo(hero/header 区域)
   - 第二行:navbar 链接
   - 第三行以下:Google 搜索 + 卡片,统一在 80% 居中区
   ============================================================ */

/* 1. 顶部 Hero Header(logo + 标题) */
#app .hero .hero-body {
    display: flex !important;
    justify-content: center !important;
    padding: 1.5rem 0 !important;
}

#app .hero .hero-body .container {
    width: 80% !important;
    max-width: 80% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* 2. Navbar 与 logo 行对齐(左右各留 10%) */
#app .navbar {
    padding-left: 10% !important;
    padding-right: 10% !important;
}

/* 3. 搜索区(message 区域)透明化 */
#app .message,
#app .message-body {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* 4. Section 全宽,container 不限制宽度 */
#app section.section > .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-left: 10% !important;
    padding-right: 10% !important;
}

/* 5. 主内容卡片区:用 padding 收窄,与搜索框对齐
   DOM 结构:#main-section > .container > div > .columns.is-multiline
   直接对 .container 加 padding 来控制左右边距 */
#app #main-section .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-left: 10% !important;
    padding-right: 10% !important;
}

预期效果

  • navbar 左边缘:页面 10% 处
  • 搜索框左边缘:页面 10% 处(继承 section > .container 的 padding)
  • 卡片区左边缘:页面 10% 处(通过 #main-section .container 的 padding 控制)
  • 三者左右边缘完全对齐

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@LR1933 LR1933 marked this pull request as ready for review February 26, 2026 09:29
@LR1933 LR1933 merged commit c6e11a9 into main Feb 26, 2026
1 check failed
Copilot stopped work on behalf of LR1933 due to an error February 26, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants