Hi i am working on a react todolist and I am having trouble with the CSS, can someone with more experience help me with figuring out the problem I am encountering? No matter what I do I can’t seem to get the checkbox to appear beside the placeholder text how do I do this in CSS
import React from "react"
function TodoItem() {
return (
<div className="todo-item">
<input type="checkbox" />
<p>Placeholder text here</p>
</div>
)
}
export default TodoItem
?
2
Answers
You can use "span" instead of "p" to fix this.
The
p
paragraph element is block-level, therefore will start on its own line. The easiest way to put the two elements side-by-side while being able to control the alignment of theinput
is to use Flexbox. Adddisplay: flex;
declaration to the.todo-item
rule in your CSS.