Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 文本未居中对齐且大小不变_Html_Css - Fatal编程技术网

Html 文本未居中对齐且大小不变

Html 文本未居中对齐且大小不变,html,css,Html,Css,因此,我的字体不会改变大小或居中对齐。我试过很多东西,但都没有结果。我希望代码(文本)居中,但它当前正在向左对齐。我还希望文本要大得多。请看一下我的代码 HTML <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> ... <div class="qt"> <? $filename = "quotes.txt";

因此,我的字体不会改变大小或居中对齐。我试过很多东西,但都没有结果。我希望代码(文本)居中,但它当前正在向左对齐。我还希望文本要大得多。请看一下我的代码

HTML

<head>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>

...

<div class="qt">
    <?
        $filename = "quotes.txt";
        function RandomLine($filename) { 
            $lines = file($filename); 
            echo $lines[array_rand($lines)]; 
        } 
        echo RandomLine($filename);
    ?>
</div>
<div class="home">
    <a href="http://www.jonsnow.net/index.php" id="h1"></a>
    <a href="http://www.jonsnow.net/gallery/" id="h2"></a>
</div>
摘掉

center
在你的CSS中。以及字体大小和颜色。

将其更改为:

div.qt {
    text-align: center;
    font-family: Vivaldi;
    font-size: 44px;
    color: #000000;
    position: absolute;
    top: -60%;
    bottom: 0;
    left: 0;
    right: 0;
    width: 1000px;
    margin: auto;
    height: 62px;
    display: inline;
}

我注意到它的另一个问题,在div.home img{}上,您有float:top;您不能将元素浮置在顶部,如果包含生成的HTML而不是PHP代码,您可以使用Left、Right、None或Inherit,这可能更易于可视化。此外,请删除
字体大小
颜色
中的引号。带引号的属性会有不同的解释。哦。。那很简单。。。非常感谢你。
div.qt {
    text-align: center;
    font-family: Vivaldi;
    font-size: 44px;
    color: #000000;
    position: absolute;
    top: -60%;
    bottom: 0;
    left: 0;
    right: 0;
    width: 1000px;
    margin: auto;
    height: 62px;
    display: inline;
}