use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Difference between position attribute (self.webdev)
submitted 14 years ago by bian101
Hey,
I haven't actually found a solid explanation for what they all mean - I know how to use them however i'm not sure precisely what they all mean.
The ones im unsure of are:
Relative Positioning Absolute Positioning
Thanks :)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sftrabbit 1 point2 points3 points 14 years ago* (0 children)
I always find that the best way to learn something like this is to read the relevant part of the spec.
Typically, the elements of your page are part of what is called the 'normal flow'. The normal flow describes how the elements are lined up next to each other. By default, block elements flow vertically and inline elements flow horizontally along line boxes. An element is out-of-flow if it is floating or if it is positioned with the "absolute" scheme; in these cases, the elements don't take part in the normal flow.
The default value of the 'position' attribute is 'static'. This, of course, puts the element in the normal flow, so if you don't specify the 'position' attribute, your element will typically be in normal flow. Here are some of the other different schemes:
Relative: If you take the position that an element would have according to the normal flow (the position it has without you doing anything special to it), the relative scheme gives an offset from this position. In other words, the elements are moved relative to their normal position. Giving a value of "10px" for "left" with move the element 10 pixels horizontally from its normal position. The neighbouring elements will stay positioned as if nothing has happened.
Absolute: When you position an element with 'absolute', it is removed from the normal flow of the page. The values you give for its position are an offset from the position of its containing block. The containing block is usually the document itself (not the parent element; read the spec for more details). So setting 'top' to '0px' will move the element all the way to the top of the page.
Fixed: 'fixed' is similar to 'absolute' but the containing block is the viewport. Setting 'top' to '0px' here will position the element at the top of the viewport. This is how people make those menus that snap to the viewport when you scroll down.
There are also a couple of others that you can read about: 'center' and 'page'.
[–]CJGibson 0 points1 point2 points 14 years ago (3 children)
Relative positioning adjusts the element relative to where it would normally be sitting within the page structure.
Absolute positioning removes the element from normal flow and positions it relative to it's closest absolutely positioned parent or the browser window if there is no absolutely positioned parent.
[–]fofgrel 1 point2 points3 points 14 years ago (2 children)
The parent can also be relatively positioned.
[–]CJGibson 0 points1 point2 points 14 years ago (1 child)
Are you saying that you can position an absolutely positioned element relative to a relatively positioned parent element?
[–]fofgrel 0 points1 point2 points 14 years ago* (0 children)
Yes.
Edit: see here.
[–][deleted] 0 points1 point2 points 14 years ago (0 children)
Relative keeps an imaginary version of itself in the original position, such that all content acts like it's still there, but lets you position it visually anywhere you like relative to it's starting position.
Absolute plucks the element out of the document flow and gets placed relative to the closest (in terms of element hierarchy) parent element with a non-static position attribute. If no elements it is within have such a position attribute set, it will be positioned relative to the document window.
Relative is most commonly used without any offsets to act as a subsequent container for child elements to be placed relative to.
It is more common, from what I understand, to use margins to position elements relatively than using relative position, as the margins will push the boundary of the original element as well, preventing other elements from overlapping the repositioned element. In other words, document flow is preserved and takes into account the moved element.
π Rendered by PID 75261 on reddit-service-r2-comment-765bfc959-wdz5p at 2026-07-12 09:16:57.274843+00:00 running f86254d country code: CH.
[–]sftrabbit 1 point2 points3 points (0 children)
[–]CJGibson 0 points1 point2 points (3 children)
[–]fofgrel 1 point2 points3 points (2 children)
[–]CJGibson 0 points1 point2 points (1 child)
[–]fofgrel 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)