What is the standard method of positioning elements on a page?

Asked

Viewed 108 times

1

What is the standard method of positioning elements on a page?

I ask because I had seen in some material that by default the elements on a page (HTML) have the property position defined as relative, but searching I can not find a material to confirm this thesis (I took a look at the W3S and nothing).

  • 1

    answering the question with humor.... one below the other preferably

  • I didn’t get your comment @Otto

  • the standard method for positioning the elements is one below the other .... preferably with identation

  • @Cold is complicated this business of standard, it is better to force the relative "manually" to avoid the inside Bsolute get lost by the page.

  • So if I put two div's, widths of 10px each, and visualize on a screen of 17 inches for example (even maximized window), it will put one underneath the other?

  • @Bacco I also prefer to "reinforce", but usually it behaves as relative for the remarks I made.

  • facepalm..... forget my comments I was joking

  • At good @Otto, after realizing even gave pa laugh bro. : D

  • @Cold try to insert 3 Ivs of different sizes and an Absolute element within the latter, which you will see that the default is not relative :)

  • 3

    Just to reinforce something that’s nailed to gringa and which I strongly agree with: Avoid links to W3S. Their content is very weak. Prefer linking to MDN :)

  • 1

    Possible duplicate: http://answall.com/questions/23532/toda-div-tem-posi%C3%A7%C3%A3o-relative

Show 6 more comments

1 answer

1


The standard method is static, which positions the element in order of appearance.

The other methods are:

  • Absolute: Positions the element according to a defined ancestor with the property relative
  • Fixed: Position the element relative to "screen".
  • relative: The difference between this method and the static is that you can use the properties left, top.
  • initial: Points to the initial value of the property in the case static
  • inherit: Defines as the same property of the parent element.

Source: w3schools

  • thanks (for showing me what I hadn’t noticed). D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.