Html 如何在屏幕中间移动博客标题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9542946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:55:15  来源:igfitidea点击:

How to move blog title in the middle of the screen?

htmlcssblogsbloggertitle

提问by fuddin

I am very new to blogging. My blog has its title description at the top-left but I want it to be in the middle of the screen and the description of the blog beneath the image.

我对博客很陌生。我的博客在左上角有它的标题描述,但我希望它在屏幕的中间,而博客的描述在图像下方。

I tried the following code but the title is still at the top-left corner:

我尝试了以下代码,但标题仍在左上角:

<title style="text-align:center"><data:blog.pageTitle/></title>

Thanks in advance.

提前致谢。

回答by Stephan Muller

The <title>element isn't used for the title displayed on your website, only for the title in the browser's top bar.

<title>元素不用于您网站上显示的标题,仅用于浏览器顶部栏中的标题。

You'll have to edit the CSS file and set #titlewrapper { text-align: center }

您必须编辑 CSS 文件并设置 #titlewrapper { text-align: center }

Alternatively you can add style="text-align: center"in the <div id='titlewrapper'>in your HTML.

另外,您可以添加style="text-align: center"<div id='titlewrapper'>你的HTML。

回答by Frank

<div style="text-align:center">Title of your blog</div>

回答by Starx

Well, I got it. The title is wrapped with a <h1>which is by default aligned at the left. so change it's CSS to text-align:center;

嗯,我明白了。标题用 a 包裹,<h1>默认情况下在左侧对齐。所以将它的 CSS 更改为text-align:center;

Use this

用这个

#titlewrapper h1 { text-align:center; }

回答by Hajj Maulid Makokha

This worked well for me
STEP1: Dashboard > Tepmlate > Edit HTML
STEP2:Search in the editor by pressing Ctrl+F for the following headercode:.Header h1 {
STEP3: Save your work and refresh the page
THE BLOG TITLE SHOULD NOW BE IN THE MIDDLE OF THE PAGE

这对我来说效果很好 第
1 步:仪表板 > 模板 > 编辑 HTML 第 2
步:在编辑器中按 Ctrl+F 搜索以下标题代码: 第.Header h1 {
3步:保存您的工作并刷新页面
博客标题现在应该在页面的中间

BONUS - Here is the code I added: text-align: center;
You can also add the same code in the description below your blog title code to align it at the center. Here is the description code you should search for in the editor: .Header .description {
Add the same code in it text-align: center;

奖励 - 这是我添加的代码:text-align: center;
您还可以在博客标题代码下方的描述中添加相同的代码,使其居中对齐。这是您应该在编辑器中搜索的描述代码:在其中.Header .description {
添加相同的代码text-align: center;

回答by karem

You can also put style="text-align: center"next to div class='titlewrapper'in html and it will work.

您也可以在 html 中放置style="text-align: center"旁边div class='titlewrapper',它会起作用。