html - Upvote 和 downvote 按钮没有相互显示
问题描述
我正在构建一个 BlogApp 并且我正在尝试制作 upvote 和 downbutton ,就像 Stack Overflow 显示但我的按钮没有显示opposite one another
。
它们显示如下:
模板.html
<!-- Upvote button -->
<span id="id_likes{{topic.id}}">
{% if user in topic.likes.all %}
<button name='submit' type='submit' value="like"><i class="btn fas fa-sort-up fa-6x fa-lg post-buttons " ></i></button>
{% endif %}
</span>
<!-- DownVote button -->
<span id="id_dislikes{{topic.id}}">
{% if user in topic.dislikes.all %}
<button name='submit' type='submit' value="dislike"><i class="fas fa-sort-down fa-6x"></i></button>
{% endif %}
</span>
当我使用div
而不是span
then 它显示如下:
它在按钮上显示边框,然后我使用:
<style>
button {
padding: 0;
border: none;
background: none;
}
</style>
任何帮助将非常感激。
解决方案
我删除了您的动态代码并添加了一个 css 类。
button {
padding: 0;
border: none;
background: none;
}
.btnOuter{
display: block;
overflow: hidden;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet" />
<span>
<button class="btnOuter" name='submit' type='submit' value="like">
<i class="fas fa-sort-up fa-6x fa-lg post-buttons" ></i>
</button>
</span>
<span>
<button class="btnOuter" name='submit' type='submit' value="dislike">
<i class="fas fa-sort-down fa-6x"></i>
</button>
</span>
推荐阅读
- bash - Bash:本地数组阴影参数最终为空
- sql - 在一个 SQL Server 存储过程中同时包含 INSERT 和 UPDATE 查询
- vue.js - TypeError:无法读取未定义的属性“$http”
- azure-cosmosdb - Cosmos DB:网关不能直接服务跨分区查询
- c# - C# 图形:区域剪辑和命中测试
- angular-cli - 当我创建 Angular 项目时。显示此类型错误。现在我该怎么办
- javascript - 无法在 AWS Lambda 中使用 NPM 包,require() 已损坏
- python - 从函数返回用户提供的值
- php - Strpos 2 变量
- mysql - 发送 DELETE 查询时,innoDB 是从数据库中逐一删除数据,还是先创建要删除的数据列表?