css - 从 FullCalendar v5 中删除日历的外部边界
问题描述
我一直在尝试删除日历的外边框,但是我设法做到的最好的方法是删除所有边框(或仅删除水平/垂直边框)。我只需要去掉外边框(图片显示了我需要的东西;日历的底部不在屏幕截图中https://i.stack.imgur.com/hXAYP.png)。到目前为止,我在 chrome 开发工具中花了很长时间试图弄清楚我可以在哪里做到这一点,但我似乎找不到解决方案。
作为参考,我正在使用一个 css 文件来覆盖 fullcalendar css。我不认为我的代码是必要的,因为我什至找不到只删除外边框的正确元素。我正在使用border-style: none !important;
我也尝试border: 0px !important;
过。
我正在寻找的元素可能在 cdn 中用于 fullcalendarv5 的 css 方面:https ://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.css
编辑:代码
cal.html 示例:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.css">
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.min.css"> -->
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'timeGridWeek',
events: '/event_view/',
headerToolbar: {
left: 'dayGridMonth,timeGridWeek,timeGridDay, listWeek',
},
height:'97vh',
});
calendar.render();
});
</script>
{% load static %}
<link rel="stylesheet" href="{% static 'calendar_app/cal.css' %}" type="text/css">
<!-- Event making stuff; not relevant-->
<div class="content-calendar" id="content", name="content-calendar">
<div id='calendar'></div>
</div>
cal.css 示例:
.fc {
color: green;
}
./*THE ELEMENT I CURRENTLY CANNOT FIND WOULD GO HERE*/ {
border-style: none !important;
}
解决方案
您可以简单地在此类上使用 border:none.fc-scrollgrid
来删除边框top
和left
要从侧面移除边框,我们需要使用last-of-type伪类来仅从td
使用中移除border-right.fc-scrollgrid td:last-of-type
运行下面的代码片段以查看它的工作原理。图片中没有您想要的边框。
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'timeGridWeek',
/*events: '/event_view/',*/
headerToolbar: {
left: 'dayGridMonth,timeGridWeek,timeGridDay, listWeek',
},
height: '97vh',
});
calendar.render();
});
.fc-scrollgrid {
border: none !important;
}
.fc-scrollgrid td:last-of-type {
border-right: none !important;
}
<!-- Event making stuff; not relevant-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.css">
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.min.css"> -->
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.1.0/main.min.js"></script>
<div class="content-calendar" id="content" , name="content-calendar">
<div id='calendar'></div>
</div>
推荐阅读
- python - 为什么当我使用 pytest 时日志记录不起作用
- c# - 当我尝试从 mysql 数据库加载图像时,出现错误“参数无效”,当我尝试从 db 加载图像时
- python - Python无缘无故地带来了空的数据框
- python - 未在类和单元测试中定义的用户函数
- python - 如何实现布局以将值解析为并获取文件作为回报?
- watson-discovery - 在 Watson Discovery 中进行了查询,尝试通过 nodejs sdk 进行复制,通道数组为空
- swift - 我的日期选择器中的文本显示在模拟器中,但在我的 ios14 手机上运行时没有
- android - 如何在不从 android 创建子节点的情况下将字符串值填充到实时 firebase 数据库?
- laravel - SQLSTATE [42S22]:未找到列:1054 '字段列表'中的未知列 'Update_Profile'(SQL:更新 `users` 设置 `updated_at` = 2021-01-11 00:01:39,
- asp.net-core-mvc - .net core razor 页面@Html.Display 用于显示随机数