作为Web开发中的第一个项目,我正在构建一个博客。我遇到了一个问题,当我在用户名旁边添加个人资料图片时,就会出现混乱。
在此处运行相同的代码似乎表明它可以正常工作,但事实并非如此。有什么想法吗?
非常感谢您的帮助。
body {
background: url('redpattern.jpg') no-repeat center fixed;
background-size: auto;
/* color: #333333;*/
margin-top: 5rem;
}
#ruleslist {
padding-top: 25px;
color: #ffffff;
font-size: 2em;
}
#holly {
position: absolute;
height: 600px;
width: 90%;
}
h1, h2, h3, h4, h5, h6 {
color: #000000;
}
#sidebar {
color: #000000;
}
ul {
margin: 0;
}
bg-steel {
color: #b52525;
}
.site-header .navbar-nav .nav-link {
color: #ffffff;
}
.site-header .navbar-nav .nav-link:hover {
color: #208ee8;
}
.site-header .navbar-nav .nav-link.active {
font-weight: 5500;
}
.content-section {
background: #ffffff;
padding: 10px 20px;
border: 1px solid #dddddd;
border-radius: 3px;
margin-bottom: 20px;
}
.article-title {
color: #444444;
}
a.article-title:hover {
color: #418ac9;
text-decoration: none;
}
.article-content {
white-space: pre-line;
}
.article-img {
height: 65px;
width: 65px;
margin-right: 16px;
}
.article-metadata {
padding-bottom: 1px;
margin-bottom: 5px;
border-bottom: 1px solid #e3e3e3
}
.article-metadata a:hover {
color: #333;
text-decoration: none;
}
.article-svg {
width: 25px;
height: 25px;
vertical-align: middle;
}
.account-img {
height: 125px;
width: 125px;
margin-right: 20px;
margin-bottom: 16px;
}
.account-heading {
font-size: 2.5rem;
}
{% extends "blog/base.html" %}
{% block content %}
{% for post in posts %}
<article class="media content-section">
<img class="rounded-circle article-img" src="{{ post.author.profile.image.url }}"
<div class="media-body">
<div class="article-metadata">
<a class="mr-2" href="{% url 'profile' %}">{{ post.author }}</a>
<small class="text-muted">{{ post.date_posted|date:" l, F d, Y @ P" }}</small>
</div>
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
<p class="article-content">{{ post.content }}</p>
</div>
</article>
{% endfor %}
{% endblock content %}