CSS is absolutely the right tool for constructing layouts because it allows you to make your components with a class (like "commandLine") and then control exactly how that input box lays out on the screen, not only its font and color but also height, scrolling, expanding or not with the window and content, and everything else that affects the look.
Ideally, JS is only for computation, HTML only for making content containers, and all layout and appearance is in CSS.
Attributing behaviors through names is not unique to css and it’s not particularly the right tool. It’s the only tool you have in browser, yes. But let it invent ways to avoid things like negative margins, harmfully cascading layout rules, etc, before calling it “right”.
And gp is absolutely correct about it being fragile, cause it’s fragile as hell.
Ideally, JS is only for computation, HTML only for making content containers, and all layout and appearance is in CSS.