Questions tagged [position]

Position refers to the location of an element relative to its container, typically on the horizontal and vertical axes.

In computing, position closely relates to the geometrical definition of a position or position vector, also known as location vector or radius vector, which is a Euclidean vector that represents the position of a point P in space in relation to an arbitrary reference origin O. Usually denoted x, r or s, it corresponds to the displacement from O to P.

In simplified terms, position is used in reference to the location of a 'child' entity within a two-dimensional or three-dimensional space, the boundaries of which are referred to as the 'container' or 'parent'.

8525 questions
1816
votes
28 answers

Retrieve the position (X,Y) of an HTML element relative to the browser window

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window.
monaung
1094
votes
9 answers

How to overlay one div over another div

I need assistance with overlaying one individual div over another individual div. My code looks like this:
Unfortunately I cannot nest the…
tonyf
  • 30,749
  • 43
  • 137
  • 216
701
votes
25 answers

Fixed position but relative to container

I am trying to fix a div so it always sticks to the top of the screen, using: position: fixed; top: 0px; right: 0px; However, the div is inside a centered container. When I use position:fixed it fixes the div relative to the browser window, such as…
Zach Nicodemous
  • 7,868
  • 8
  • 42
  • 64
403
votes
16 answers

Slide right to left?

How can I have a div go from collapsed to expanded (and vice versa), but do so from right to left? Most everything I see out there is always left to right.
Ryan Montgomery
  • 14,270
  • 16
  • 53
  • 63
282
votes
7 answers

Git alias with positional parameters

Basically I'm trying to alias: git files 9fa3 ...to execute the command: git diff --name-status 9fa3^ 9fa3 but git doesn't appear to pass positional parameters to the alias command. I have tried: [alias] files = "!git diff --name-status $1^…
user400575
  • 2,995
  • 2
  • 13
  • 10
276
votes
24 answers

How does the "position: sticky;" property work?

I want to make the navigation bar stick to the top of the viewport once a user scrolls the page, but it's not working and I have no clue why. If you can please help, here is my HTML and CSS code: .container { min-height: 300vh; } .nav-selections…
Harleyoc1
  • 2,763
  • 2
  • 7
  • 10
257
votes
9 answers

How to set iPhone UIView z index?

I want to move one view on top of another, how can I know the z index of the view, and how to move on to top?
Tattat
  • 14,290
  • 32
  • 84
  • 135
232
votes
15 answers

Make absolute positioned div expand parent div height

As you can see in the CSS below, I want child2 to position itself before child1. This is because the site I'm currently developing should also work on mobile devices, on which the child2 should be at the bottom, as it contains the navigation which I…
user557419
218
votes
5 answers

SVG Positioning

I'm having a play with SVG and am having a few problems with positioning. I have a series of shapes which are contained in the g group tag. I was hoping to use it like a container, so I could set its x position and then all the elements in that…
ChrisInCambo
  • 7,767
  • 15
  • 47
  • 63
208
votes
11 answers

How to set JFrame to appear centered, regardless of monitor resolution?

While working with Java, I find it hard to position my main window in the center of the screen when I start the application. Is there any way I can do that? It doesn't have to be vertically centered, horizontal alignment is the more important goal…
AmateurProgrammer
  • 2,319
  • 3
  • 15
  • 14
185
votes
8 answers

Set the absolute position of a view

Is it possible to set the absolute position of a view in Android? (I know that there is an AbsoluteLayout, but it's deprecated...) For example, if I have a 240x320px screen, how could I add an ImageView which is 20x20px such that its center is at…
Sephy
  • 48,024
  • 30
  • 119
  • 129
152
votes
13 answers

RecyclerView - Get view at particular position

I have an activity with a RecyclerView and an ImageView. I am using the RecyclerView to show a list of images horizontally. When I click on an image in the RecyclerView the ImageView in the activity should show a bigger picture of the image. So far…
Vamsi Challa
  • 10,228
  • 30
  • 92
  • 143
148
votes
7 answers

Get position/offset of element relative to a parent container?

I'm used to working with jQuery. In my current project however I use zepto.js. Zepto doesn't provide a position() method like jQuery does. Zepto only comes with offset(). Any idea how I can retrieve the offset of a container relative to a parent…
matt
  • 37,699
  • 99
  • 250
  • 390
148
votes
10 answers

CSS3 box-sizing: margin-box; Why not?

Why don't we have box-sizing: margin-box;? Usually when we put box-sizing: border-box; in our style sheets we really mean the former. Example: Let's say I have a 2 column page layout. Both columns have a width of 50%, but they look kind of ugly…
Web_Designer
  • 64,966
  • 87
  • 197
  • 254
140
votes
13 answers

RecyclerView - How to smooth scroll to top of item on a certain position?

On a RecyclerView, I am able to suddenly scroll to the top of a selected item by using: ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, 0); However, this abruptly moves the item to the top position. I…
1
2 3
99 100