我正在制作一个非常简单的html网页,仅包含文字.如何缩小单列以使读者更容易阅读?
我希望文本正文大致位于页面的中心并保持对齐,左边和右边的空白边距(大致相等).
通过将文本放在带有样式的DIV中来控制宽度:
Text goes here.
根据安吉拉在评论中提出的建议,以中心为中心:
Text goes here.
And another line which is much longer.
html:
CSS:
body { text-align:center; /* this is required for old versions of IE */ } #centered { width:400px; /* this is the width of the center column (px, em or %) */ text-align:left; /*resets the text alignment back to left */ margin:0 auto; /* auto centers the div in standards complaint browsers */ }
就是这样,享受吧!