Hi I am trying to write the word “SCAN” with a green box around it, can you please help me? Here is what I have done so far:
But as you see the box stretches until the end of the screen…
I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
That’s occuring because <ul> (the element that you applied the scan class to) is considered to be a block-level element, and block-level elements span the entire width of the viewport by default.
So one way to achieved your desired effect is to change it to an inline-block (or inline) element instead, so that it doesn’t span the width of the viewport. I’ll leave that as an exercise for you as to how to do that.