Просмотр исходного кода

Remove 1px space above week number in day cell

Existing CSS adds a 1px padding to the top of `.fc-content-skeleton`
in agenda and basic views. Together with the 1px top margin on
`.fc-day-grid-event`, this results in a total 2px distance between
the border and the first event.

This method was introduced in [commit b2fbdfa][1] of Aug 26, 2014 and
is based on the assumption that there are no day numbers in the
`.fc-content-skeleton` of the affected views.

However, with the new option to display week numbers in day cells
(`basicViewWeekNrPosition: 'weekNrDayCell'`), week numbers may now be
rendered in `.fc-content-skeleton`. In `basicWeek` and `basicDay`
views, the existing CSS will lead to a 1px distance between the week
number and the border above it, which may be undesirable.

This commit resolves that by reversing most of commit b2fbdfa. The
desired 2px distance above the first event is now again accomplished
by setting a 2px instead of a 1px top margin on the first
`.fc-day-grid-event` only. This in turn allows the 1px padding to the
top of `.fc-content-skeleton` to be removed.

Please review this commit carefully, since I do not know all the
reasons behind the commit it largely reverses. I am willing to discuss
alternative methods.

[1]: https://github.com/fullcalendar/fullcalendar/commit/b2fbdfa092b8bc131b61f1f3b3df98901929c66c
Peter Nowee 10 лет назад
Родитель
Сommit
5a4fd11d65
3 измененных файлов с 4 добавлено и 3 удалено
  1. 0 1
      src/agenda/agenda.css
  2. 1 2
      src/basic/basic.css
  3. 3 0
      src/common/common.css

+ 0 - 1
src/agenda/agenda.css

@@ -12,7 +12,6 @@
 }
 
 .fc-agenda-view .fc-day-grid .fc-row .fc-content-skeleton {
-	padding-top: 1px; /* add a pixel to make sure there are 2px padding above events */
 	padding-bottom: 1em; /* give space underneath events for clicking/selecting days */
 }
 

+ 1 - 2
src/basic/basic.css

@@ -6,8 +6,7 @@
 
 .fc-basicWeek-view .fc-content-skeleton,
 .fc-basicDay-view .fc-content-skeleton {
-	/* we are sure there are no day numbers in these views, so... */
-	padding-top: 1px; /* add a pixel to make sure there are 2px padding above events */
+	/* there may be week numbers in these views, so no padding-top */
 	padding-bottom: 1em; /* ensure a space at bottom of cell for user selecting/clicking */
 }
 

+ 3 - 0
src/common/common.css

@@ -620,6 +620,9 @@ be a descendant of the grid when it is being dragged.
 	padding: 0 1px;
 }
 
+tr:first-child > td > .fc-day-grid-event {
+	margin-top: 2px; /* a little bit more space before the first event */
+}
 
 .fc-day-grid-event .fc-content { /* force events to be one-line tall */
 	white-space: nowrap;