html - html 或 css 来调整和格式化博客文章的宽度
问题描述
我的网站上的代码有些困难。现在我的博客文章文本跨越内容页面的整个宽度并居中。
我希望文本左对齐,每边的边距相等,并使博客内容的宽度更窄,因此每行的字符更少..就像这个示例博客文章
我希望使每篇博客文章都采用相同的格式,但我尝试过的一切似乎都不起作用?我不确定我应该更改或添加什么 css/html。我已经尝试过调整框大小、调整边距以及调整边距,但它并没有给我我正在寻找的结果,而且我不确定要采取什么步骤。任何帮助,将不胜感激。
谢谢!
解决方案
您应该创建新<div id="test">
元素并将文本放入其中。为该 div 添加以下 CSS:
#test{
width: 680px; /* adding width of text field */
margin: 0 auto; /* centering it */
text-align: left; /* aligning text to left side */
font-size: 15px; /* size of your font */
line-height: 24px; /* space between two lines */
letter-spacing: -0.01em; /* space between two letters */
/* By playing with values of last 3 lines you can make text look exactly how you want, I tried to mimic site that you posted as much as I could (I c/p-ed their CSS for text) */
}
推荐阅读
- delphi - 如何在 DWScipt 中初始化对象?
- r - R 正则表达式列出不以例如“AA”或“BB”开头的文件
- r - 我的 group by 似乎没有在磁盘框架中工作
- marklogic - MarkLogic TDE 框架是否支持包含可重用的模板片段?
- excel - 由于按钮,Excel VBA 文件打开速度很慢
- javascript - 在反应中单击img时添加一个圆圈
- winapi - Direct2d 无论窗口大小如何,都可以通过监视器大小在窗口上绘制吗?
- javascript - 如何在 HTML JavaScript 中显示输入文本中的图像?
- r - 在 tufte_handout 代码块中包含换行符?
- c++ - 我的代码出现错误。问题:从前序和中序遍历构造二叉树