In my intro page I have a really big image in height and width to fit all the resolutions (more than 4000px in width) and I set it as below:
#source-image {
width: 100%;
position: absolute;
top: 0;
left: 0;
}
Then, I added some text over that image with these style properties:
.description {
position:absolute;
top:510px;
left:23px;
width:340px
}
And it looks properly (and as I want it to be shown) on my 15.6 inch laptop with 1366×768 resolution.

However when my roommate saw it on his high resolution monitor the description was not on the “right” position. Of course, I understand why this is happening.

My question is how can I keep dynamically the proper position of the description text in all resolutions?
Thank you very much.
Set the distance from the bottom, not from the top. Or set it in %.
EDIT: I’ve adapted one of my experiments into an example: http://dabblet.com/gist/2787061
The position of the description is set relative to the
bottomand theleftof the image container (the image is filling its entire container).In the first case, the distances to the
leftand thebottomof the image container are fixed, in px.In the second case, they are in % and change on resizing the browser window.
Basically, the rules that do the trick are
in the fist case (fixed distances, in px) and
in the second case (percentage).
Also, please note that you don’t need
position: absoluteor to set thetopand theleftproperties for the image.However, you do need to set
position:relativeon the parent of the description box.For the image to fill the screen horizontally, you need to have
margin:0;andpadding:0;on the body element andwidth: 100%;andmargin: 0;on the figure element. I’ve edited my example to reflect these changes http://dabblet.com/gist/2787061For the image to fill the screen both horizontally and vertically, the easiest way is to not even use an img tag, but simply set the image as a background image for the body and set the height for both the html and the body elements to 100% – example http://dabblet.com/gist/2792929
Be careful for two reasons: one, this will really distort the image and can make it look ugly when resizing the browser window and two, if you need some content below the image you will need to give the the outer element
position: absoluteand set itstop: 100%. Both these two aspects can be seen in the example I’ve linked to. You can simply remove the content below the image if you don’t need it.