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

修改index.html中<p>标签文本后CSS格式异常求助

问题描述

我在搭建个人网站时,仅修改了index.html中一段<p>标签内的文本内容——删除了关于Python开发Discord机器人的语句,之后网站的CSS格式出现异常。我实在搞不懂为什么只改文本会影响样式,毕竟我完全没改动任何标签或CSS规则。

修改前后代码对比

修改前:

<p>
    I have a few coding projects I am working on that can be found on my GitHub.  These projects mainly include work in HTML/CSS, JavaScript, and C++.  I have also developed a Discord bot for a server using Python.
</p>

修改后:

<p>
    I have a few coding projects I am working on that can be found on my GitHub.  These projects mainly include work in HTML/CSS, JavaScript, and C++.
</p>

已尝试的排查操作

  • 删除文件末尾的异常内容
  • 对比其他使用css/global.css的页面,未发现样式问题
  • 本地打开index.html显示正常
  • 执行systemctl restart apache2命令重启Apache以清理缓存
  • 清理浏览器缓存
  • 确认其他页面使用相同CSS文件,无差异

相关CSS代码

以下是css/global.css的内容:

/*Body parameters*/
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #D9D9D9;
    justify-content: center;
    margin: auto;
    width: auto;
    clear: both;
}

/* Site Version */
.siteVersion {
    font-family: 'Courier New', Courier, monospace;
    font-style: italic;
}

/* Content formatting */
.content {
    position: flex;
    padding: 10px;
    align-content: center;
    margin: auto;
    max-width: 80%;
    background-color: #E6E6E6;
    padding: 20px;
    overflow-y: auto;
}

.grid-container {
    display: grid;
    grid-gap: 5px;
    max-width: auto;
    margin: auto;
    background-color: #E6E6E6;
    align-content: center;
    height: 100%;
    clear: both;
}

.profilePicture {
    float: left;
    margin: 10px;
    height: 165px;
    width: 200px;
}

/* Paragraph */
.paragraph {
    font-family: Arial, Helvetica, sans-serif;
    max-width: 100%;
    margin: auto;
    word-wrap: break-word;
    white-space: pre-line;
}

/* Hyperlinks */
.email {
    font-family: monospace;
    text-decoration: none;
}

.hyperlink {
    text-decoration: none;
}

求助需求

请精通CSS的开发者帮忙排查样式异常的原因,并给出解决建议。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 09:33:17