Skip to content

Commit 4cb51cb

Browse files
rafhrafh
and
rafh
authored
Absolute positioned checkboxes overlay floated elements (#26870)
Currently, checkboxes are positioned as absolute. This positioning causes the input to overlay an element that has been floated within the editor. Floated elements are useful if you want your text to wrap around this element. This PR fixes the overlaying of checkboxes by removing the absolute positioning, updating the `ul` padding, and displaying`.task-list-item` `flex` to ensure inputs and the associated label are on the same line. Screenshots: Before: <img width="762" alt="Screenshot 2023-09-01 at 3 40 59 PM" src="https://github.com/go-gitea/gitea/assets/6152817/570247c7-7f5c-4697-bfc9-ad4655e37991"> After: <img width="762" alt="Screenshot 2023-09-01 at 3 42 20 PM" src="https://github.com/go-gitea/gitea/assets/6152817/db53df45-1294-4eee-84c0-b21ac4fdf805"> --------- Co-authored-by: rafh <[email protected]>
1 parent 7d14aa0 commit 4cb51cb

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

web_src/css/markup/content.css

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,29 @@
155155

156156
.markup .task-list-item {
157157
list-style-type: none;
158-
position: relative;
159-
line-height: 1.5rem;
160-
min-height: 1.5rem; /* // to render a checkbox list without content `- [ ]`, we need this min-height to make sure the <li> can be visible */
158+
}
159+
160+
.markup .task-list-item p + ul {
161+
margin-top: 16px;
161162
}
162163

163164
.markup .task-list-item input[type="checkbox"] {
164-
position: absolute;
165-
top: 0.25em;
166-
left: -1.6em;
165+
margin: 0 .3em .25em -1.4em;
166+
vertical-align: middle;
167+
padding: 0;
168+
}
169+
170+
.markup .task-list-item input[type="checkbox"] + p {
171+
margin-left: -0.2em;
172+
display: inline;
167173
}
168174

169-
.markup .task-list-item p {
170-
line-height: 1.5rem;
175+
.markup .task-list-item > p {
176+
margin-inline: 16px;
171177
}
172178

173179
.markup .task-list-item + .task-list-item {
174-
margin-top: 3px;
180+
margin-top: 4px;
175181
}
176182

177183
.markup input[type="checkbox"] {
@@ -327,7 +333,7 @@
327333

328334
.markup img[align="left"],
329335
.markup video[align="left"] {
330-
padding-right: 20px;
336+
padding-right: 28px;
331337
}
332338

333339
.markup .emoji {

0 commit comments

Comments
 (0)