R
R
Romkel2020-05-06 12:49:46
css
Romkel, 2020-05-06 12:49:46

Can't attach a block to a section?

Good afternoon, just started learning html, css. When completing the task, I can’t figure out how to attach the block to the right edge of the indent (which is brown) so that when the page is scaled, this block does not float away.
https://codepen.io/roman-zolotov/pen/ZEbrbvO

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-05-06
@Romkel

Your paragraph has margin:auto, i.e. not fixed, and the heading position has a hard fixation from the right edge of 25px, at different resolutions, the indent of the paragraph is different, therefore, if there is a mismatch, the difference is visible to the naked eye.
I recommend that both the paragraph and the heading in this particular example be given fixed indents:

p {
  ...
  /* width: 90%; */
  margin-right: 25px;
  margin-left: 25px;
  ...
}

And yes, remove the percentage size from the paragraph. This is a block-level element by default and will fill everything in breadth.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question