[HTML & CSS] move margin, keep text same place
Moved to programming.
From what you've shown, you can solve it by reducing the left value in css, and adding padding-left. For example,
#toptext { width: 1665px; position: absolute; top: -5px; font-size: 25px; background-color: #f1f1f1; left: 219px; padding-left: 15px; }
(you will need to change the amount that they are changed by to suit your spacing). Padding is included in the background, and you can do padding-top, -bottom, -left and -right.
However, using position: absolute like that is not a good idea. I would strongly recommend that you use a layout approach that will put things next to each other by default. The most up-to-date way to do that would be to use flex boxes, although they are a relatively advanced CSS concept and it sounds like you are just starting out. For some reason I'm struggling to come up with a beginner-friendly way of doing sidebars in CSS off the top of my head, but if you search around there should be examples.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now