Questions tagged [absolute]

In CSS, the `absolute` 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; 
}
1194 questions
1226
votes
35 answers

Center an element with "absolute" position and undefined width in CSS?

I need to place a div (with position:absolute;) element in the center of my window. But I am having problems doing so, because the width is unknown. I tried this. But it needs to be adjusted as the width is responsive. .center { left: 50%; …
Ish
  • 24,560
  • 11
  • 57
  • 75
194
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,283
  • 4
  • 15
  • 18
186
votes
24 answers

How to retrieve absolute path given relative

Is there a command to retrieve the absolute path given the 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,387
  • 8
  • 25
  • 25
173
votes
9 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
  • 7,364
  • 4
  • 37
  • 68
117
votes
7 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
107
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
  • 7,909
  • 17
  • 53
  • 106
64
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
  • 4,572
  • 4
  • 30
  • 70
52
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
  • 622
  • 1
  • 9
  • 14
50
votes
7 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
  • 365,836
  • 60
  • 503
  • 504
50
votes
2 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,034
  • 9
  • 36
  • 76
46
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
  • 563
  • 1
  • 5
  • 6
36
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
  • 17,157
  • 49
  • 178
  • 335
36
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,051
  • 5
  • 22
  • 28
27
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
  • 273
  • 1
  • 3
  • 6
26
votes
3 answers

insert vertical divider line between two nested divs, not full height

I have float left and float right
nested within a light blue box div as shown in the image below. I can't figure out how to insert a vertical line between them as shown in this image: That has the following properties: 1) padding/margin on…
Tim Koelkebeck
  • 735
  • 2
  • 9
  • 16
1
2 3
79 80