gpt4 book ai didi

不应用 CSS 规则

转载 作者:行者123 更新时间:2023-11-28 02:27:57 29 4
gpt4 key购买 nike

我有以下 CSS:

workoutcal.css:

.errorlist{
color:red;
}

以下基本模板:

base.html:

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% block title %}Default Title{% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/workoutcal.css' %}">
</head>
<body>

{% block content %}{% endblock %}

{% block footer %}{% endblock %}

<div class="hidden" id="hidden">
{% block hidden %}{% endblock %}
</div>

</body>
</html>

以及继承自它的以下模板:

{% extends "workout/base.html" %}
{% block content %}
<h1>Register new user</h1>
<form action="/workoutcal/register/" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{% for field in form.visible_fields %}
<div class="row">
<div class="col-xs-2">
{{ field.label_tag }}
</div>
<div class="col-xs-2">
{{ field }}
</div>
<div class="col-xs-3">
{{ field.errors }}
</div>
</div>

{% endfor %}
<input type="submit" value="Register">
</form>
{% endblock %}

如果有任何错误,它们将导致 <ul>带有 .errorlist 的元素在浏览器中呈现的类:

<div class="row">
<div class="col-xs-2">
<label for="id_username">Username:</label>
</div>
<div class="col-xs-2">
<input type="text" name="username" value="sahand" maxlength="150" required id="id_username" />
</div>
<div class="col-xs-3">
<ul class="errorlist"><li>A user with that username already exists.</li></ul>
</div>
</div>

我想要这个 ul 中的文字-list 是红色的,因为我试图用我的 CSS 中的规则来实现它。 CSS 包含在浏览器中呈现的 HTML 中:

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Default Title</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/static/css/workoutcal.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>

在最后link -标签。它也是 head 中的最后一个 CSS。元素。为什么错误文本没有变成红色?

最佳答案

尝试

<div class="col-xs-3">
<ul><li class="errorlist">A user with that username already exists.</li></ul>
</div>

关于不应用 CSS 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47847093/

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