gpt4 book ai didi

php - 100% 标题宽度没有填满 100% 宽度?

转载 作者:行者123 更新时间:2023-11-28 03:13:51 37 4
gpt4 key购买 nike

我有一个标题和导航栏(已附加),然后在其下方有 2 个输入框。当我将屏幕调整为较小的分辨率时,滚动条会水平显示(这很奇怪,因为页面上的所有内容都可以在不滚动的情况下看到),当我移动此滚动条时,我的标题(宽度为 100%)被切断,我只是看到它下面的背景。我过去在多个网站上都遇到过这个问题,我该如何解决?我的代码如下。

Assets /header.php

<html>
<link rel="stylesheet" type="text/css" href="/blog/assets/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/blog/assets/style.css">
<head>

</head>
<body>
<div class="header"><br><br><br>
<p>My Blog</p>
</div>
<div class="topnav" align="center">
<a href="/">HOME</a>
<a href="./latest">LATEST</a>
<a href="./all">ALL</a>
<a href="./about">ABOUT</a>
<a href="./about">SEARCH</a>
</div>

Assets /样式.css

@import url('https://fonts.googleapis.com/css?family=Indie+Flower');
body {
background-color: #D3D3D3;
margin: 0 0 100px;
font-family: "PT-Sans", sans-serif;
}

.header {
display: block;
width: 100%;
height: 200px;
background-image: url("./img/header-img.png");
background-repeat: no-repeat;
background-size: 100%;
background-size:cover;
background-position: center center;
}

.topnav {
background-color: #333;
overflow: hidden;
position: relative;
top: 0;
}

.topnav a {
display: inline-block;
color: #f2f2f2;
text-align: center;
padding: 14px 100px;
text-decoration: none;
font-size: 17px;
text-align: center;
}

.topnav a:hover {
background-color: #ddd;
color: black;
}

.topnav a.active {
background-color: #4CAF50;
color: white;
}
.header p {
color: white;
font-size: 50px;
text-align: center;
vertical-align: middle;
font-family: 'Indie Flower', cursive;
}

索引.php

<?php
include($_SERVER["DOCUMENT_ROOT"]."/blog/assets/header.php");
?>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Create Blog</title>
<form action="send.php" method="POST" class="form">
<input type="text" name="title" placeholder="Title" class="input"><br>
<textarea name="blog-text" placeholder="Blog" class="input"></textarea>
</form>

样式.css

.input {
width: 50%;
}
.form {
position: relative;
left: 25%;
}

最佳答案

将此添加到您的样式表中以 100% 填充标题

.header{
width: 100%;
margin-left: 0!important;
margin-right: 0!important;
}

关于php - 100% 标题宽度没有填满 100% 宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45573248/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com