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'.

9210 questions
84
votes
3 answers

Position element fixed vertically, absolute horizontally

Here's what I'm trying to accomplish: I need a button which is positioned a certain distance from the right side of a div, and is always that same distance from the side of the div no matter the size of the viewport, but will scroll with the…
Jimmy
  • 2,805
  • 6
  • 43
  • 57
79
votes
13 answers

Logo image and H1 heading on the same line

I want to create my first web page but I encountered a problem. I have the following code: logo

My website name

I'd like to know how to make the logo and the H1 to be in the same line. Thanks!
Six Quads
  • 815
  • 1
  • 6
  • 7
77
votes
13 answers

Fixed element disappears in Chrome

When scrolling on a website I've built, using the CSS property position: fixed works as expected to keep a navigation bar at the very top of the page. In Chrome, however, if you use the links in the navigation bar it sometimes disappears. Usually,…
cchana
  • 4,899
  • 3
  • 33
  • 43
76
votes
5 answers

Indoor Positioning System based on Gyroscope and Accelerometer

I am developing an Android App to track indoor position. My phone is an Google Nexus S using two sensors, the first being an Accelerometer and the second being a Gyroscope. My idea is that from a starting reference point (a known GPS position),…
Alexis
  • 1,825
  • 4
  • 23
  • 28
75
votes
6 answers

How to position three divs in html horizontally?

I am creating a sample website which has three divisions horizontally. I want the left most div to be 25% width, the middle one to be 50% width, and right to be 25% width so that the divisions fill all the 100% space horizontally. …
Akhil
  • 923
  • 2
  • 7
  • 10
75
votes
5 answers

Css Sibling Absolute Positioning

Is there any way to absolutely position a div relatively to its sibling? For example: Inside a div there are two other divs - div1 and div2. I want to absolutely position div2 relatively to div1.
Arg Geo
  • 915
  • 1
  • 7
  • 11
73
votes
7 answers

Get character position in alphabet

I'm 90% sure there is a built in function that does this. I need to find the position of a character in an alphabet. So the character "b" is position 1 (counting from 0), etc. Does anyone know what the function is called? What I'm trying to do is to…
qwerty
  • 973
  • 2
  • 9
  • 10
72
votes
4 answers

CSS display: inline-block does not accept margin-top?

I have an element with display: inline-block, but it doesn't seem to accept margin-top. Is this because the element is still treated as an inline element? If yes, does anyone have a workaround? EDIT #1: My CSS is quite simple: .label { …
Gregory Bolkenstijn
  • 10,003
  • 7
  • 36
  • 38
69
votes
3 answers

How to force node position (x and y) in graphviz

I am trying to force position of nodes. I have x and y coordinates of my nodes and its also directed graph. I can use the rank=same to handle row (y coordinate), but can't figure out how I can handle column (x coordinate).
user664947
  • 691
  • 1
  • 5
  • 4
68
votes
7 answers

Android: How to get the current X offset of RecyclerView?

I'm using a Scrollview for an infinite "Time Picker Carousel" and found out, that it is not the best approach (last question) Now, I found the Recycler View but I am unable to get the current scroll offset in X direction of the recyclerView? (Let's…
longi
  • 11,104
  • 10
  • 55
  • 89
68
votes
10 answers

Is it possible to keep the width of the parent element when position: fixed is applied?

When we apply position:fixed to an element, it's taken out of the normal flow of the document, therefore it doesn't respect it's parent's element width. Are there ways to make it inherit it's parent's width if this is declared as a percentage ?…
George Katsanos
  • 13,524
  • 16
  • 62
  • 98
67
votes
7 answers

Position by center point, rather than top-left point

Is it possible to tell the code to position by the center point of an element, rather than by the top-left point? If my parent element has width: 500px; and my child element has /*some width, for this example let's say it's 200px*/ position:…
kaboom1
  • 809
  • 2
  • 8
  • 9
63
votes
9 answers

CSS: Position loading indicator in the center of the screen

How can I position my loading indicator in the center of the screen. Currently I'm using a little placeholder and it seems to work fine. However, when I scroll down, the loading indicator stays right in that predefined position. How can I make it…
Frank Vilea
  • 8,323
  • 20
  • 65
  • 86
63
votes
11 answers

Get List<> element position in c# using LINQ

I have a List with numbers, and I'd like to find the position of the minimum (not value) using LINQ Example: var lst = new List() { 3, 1, 0, 5 }; Now I am looking for a function returning me output = 2 because the minimum is at position 2 in…
newUser
61
votes
13 answers

How to find index of STRING array in Java from a given value?

I wanted to know if there's a native method in array for Java to get the index of the table for a given value ? Let's say my table contains these strings : public static final String[] TYPES = { "Sedan", "Compact", …
Cyberflow
  • 1,255
  • 5
  • 14
  • 24