Questions tagged [absolute]

In CSS, the `absolute` value of the `position` property will cause an element to be positioned relative to its first non-static parent element.

Description

In CSS, the absolute value of the property will cause an element to be positioned relative to its first non-static parent element.

Example

#example { 
    position: absolute; 
    top: 20px; left: 20px; 
}
1341 questions
1506
votes
37 answers

How can I center an absolutely positioned element in a div?

I want to place a div (with position:absolute;) element in the center of the window. But I'm having problems doing so, because the width is unknown. I tried the following CSS code, but it needs to be adjusted because the width is responsive. .center…
Ish
  • 28,486
  • 11
  • 60
  • 77
233
votes
26 answers

How to retrieve absolute path given relative

Is there a command to retrieve the absolute path given a relative path? For example I want $line to contain the absolute path of each file in dir ./etc/ find ./ -type f | while read line; do echo $line done
nubme
  • 2,857
  • 8
  • 29
  • 25
232
votes
9 answers

How to center absolute div horizontally using CSS?

I've a div and want it to be centered horizontally - although I'm giving it margin:0 auto; it's not centered... .container { position: absolute; top: 15px; z-index: 2; width:40%; max-width: 960px; min-width: 600px; …
CoreDo
  • 2,691
  • 4
  • 17
  • 18
228
votes
11 answers

How to center div vertically inside of absolutely positioned parent div

I am trying to get blue container in the middle of pink one, however seems vertical-align: middle; doesn't do the job in that case.
Vladimirs
  • 8,232
  • 4
  • 43
  • 79
158
votes
8 answers

React Native absolute positioning horizontal centre

It seems that with position:absolute in use an element cannot be centred using justifyContent or alignItems. There's a workaround to use marginLeft but does not display the same for all devices even using dimensions to detect height and width of…
Hasen
  • 11,710
  • 23
  • 77
  • 135
154
votes
8 answers

Position: absolute and parent height?

I have some containers and their children are only absolute / relatively positioned. How to set containers height so their children will be inside of them? Here's the code: HTML
Foo
75
votes
9 answers

CSS z-index not working (position absolute)

I am trying to make the black div (relative) above the second yellow one (absolute). The black div's parent has a position absolute, too. #relative { position: relative; width: 40px; height: 100px; background: #000; z-index: 1; …
HTMHell
  • 5,761
  • 5
  • 37
  • 79
61
votes
8 answers

How to place a div on the right side with absolute position

I've a page where a dynamic message box has to be displayed without disturbing the actual page. This message box has to appear at the top right corner of the page overlapping the existing contents. I've tried to use position: absolute but then I'm…
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
60
votes
6 answers

Set height 100% on absolute div

I am facing a problem with overlaying a 100% height div. I could use position fixed to solve the cover, but that's not really what I want because you should be able to scroll down on the 'cover' > so people with lower resolutions than mine can see…
Nworks
  • 702
  • 1
  • 9
  • 14
57
votes
3 answers

Is there any way for "position:absolute" div to retain relative width?

Let's say I have two divs, one inside the other, like so:
Right now, the inner div has a width of 100% of 50%…
Charles
  • 4,372
  • 9
  • 41
  • 80
56
votes
4 answers

Getting absolute path of a file

How can I convert a relative path to an absolute path in C on Unix? Is there a convenient system function for this? On Windows there is a GetFullPathName function that does the job, but I didn't find something similar on Unix...
evgenka
  • 662
  • 1
  • 6
  • 6
46
votes
6 answers

How to check if a path is absolute or relative

UNIX absolute path starts with '/', whereas Windows starts with alphabet 'C:' or '\'. Does node.js has a standard multiplatform function to check if a path is absolute or relative ?
Manuel Di Iorio
  • 3,631
  • 5
  • 29
  • 31
41
votes
2 answers

Scale and reposition iframe like background-size: cover

html, body { height: 100%; margin: 0; padding: 0; } .sized { height: 100%; position: relative; background: #eee; overflow:hidden; padding:0; } .sized iframe { position:absolute; left: 0; top: 0; width:…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
30
votes
1 answer

CSS :after content below a select element causes click not to work

I have this (simplified) css for the select element to get rid of the browser-specific appearance .select{ display:inline-block; position:relative; } .select:after{ position:absolute; bottom:0;right:0; content:'\2193';…
B7th
  • 644
  • 1
  • 6
  • 17
28
votes
10 answers

Text Wrapping around an absolute positioned div

I know there are a few questions about similar topics but they mostly amount to floating the div/image. I need to have the image (and div) positioned absolutely (off to the right) but I simply want the text flow around it. It works if I float the…
Paul Murphy
  • 283
  • 1
  • 3
  • 6
1
2 3
89 90