gpt4 book ai didi

html - 删除标签后背景图像保留

转载 作者:行者123 更新时间:2023-11-28 16:06:37 24 4
gpt4 key购买 nike

我正在通过设计网页来学习 webdev,我希望登陆页面有背景图片,但后续页面没有。我的 index.html 页面扩展了 base.html 模板。我使用 body 标签来应用背景图像来覆盖页面。但我想从 results.html View 中删除它,所以在 results.html 中,我使用 header.html 扩展了一个仅 header View 。在 header.html 布局中,我删除了 body 标签,但背景图像仍然存在。

非常感谢对初学者的任何帮助。

base.html

{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>me</title>

<!-- Bootstrap core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">

<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="{% static 'css/ie10-viewport-bug-workaround.css' %}" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="{% static 'css/cover.css' %}" rel="stylesheet">

<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="{% static 'js/ie-emulation-modes-warning.js' %}"></script>

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Static navbar -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="./">About Us <span class="sr-only">(current)</span></a></li>
<li><a href="#">Log In</a></li>
<li><a href="#">Sign Up</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>

{% block main_content %}
{% endblock %}

<div class="mastfoot">
<div class="inner">
<p>me, 2016 | <a href="https://twitter.com/me">@me</a></p>
</div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="../../dist/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>


</body>



</html>

index.html

{% extends "search/base.html" %}

{% block main_content %}

<div class="site-wrapper">

<div class="site-wrapper-inner">

<div class="cover-container">
<div class="inner cover">
<h1 class="cover-heading"></h1>
<p class="lead col-xs-6 ">Search
<input type="text" class="form-control" placeholder="">
</p>
<p class="lead col-xs-6 ">Location
<input type="text" class="form-control" placeholder="City, State or Zipcode">
</p>
<p class="lead">
<a href="#" class="btn btn-lg btn-default">Search</a>
</p>
</div>

</div>

</div>

</div>

{% endblock %}

header.html

{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>me</title>

<!-- Bootstrap core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">

<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="{% static 'css/ie10-viewport-bug-workaround.css' %}" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="{% static 'css/cover.css' %}" rel="stylesheet">

<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="{% static 'js/ie-emulation-modes-warning.js' %}"></script>

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<div>

{% block main_content %}
{% endblock %}


</div>




<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="../../dist/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>

</html>

最佳答案

所有网页都需要 <body>元素,所以你不能遗漏它。有很多方法可以解决这个问题,但它们都围绕着让 CSS 最后加载到结果页面上,告诉它没有背景图像。

为了演示目的,就在您的 </head> 之前在 header.html 标签中添加代码

<style>
body {background-image: none;}
</style>

关于html - 删除标签后背景图像保留,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39110366/

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