Skip to content

修改页面宽度 #212

Answered by HEIGE-PCloud
9201314 asked this question in Q&A
Sep 9, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

你可以在 your_site/assets/css/_custom.scss 中创建你的自定义样式

在该文件中添加以下 CSS 代码以修改页面宽度。DoIt 主题默认的页面宽度为 60%,你可以将其修改为你喜欢的数值。

需要注意的是,在页面排版中,页面不应该过窄,但也不应该过宽。过宽的页面会导致读者在换行时很难定位下一行的开头。因此,通过百分比控制页面宽度也并非万无一失。在宽屏、带鱼屏上,原先恰当的宽度会被按照百分比继续拉长,导致较差的阅读体验。通过设置 max-width 属性控制页面的最大宽度,可以保证在不同屏幕尺寸下的一致文字阅读体验。

.page 
{
    width: 70%;
    max-width: 1000px;
}

对于分类、系列页面,通过以下 CSS 将每个栏目的宽度调为 100%。这可以使每行只显示一个栏目,让其中所包含的标题显示完整。

.card-item
{
    width: 100% !important;
}

另外,你必须使用 extended 版本的 hugo 来生成你的站点以使自定义样式生效。

Reference: 自定义样式

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@9201314
Comment options

Answer selected by 9201314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #210 on September 09, 2021 18:27.