I've been creating a site (nothing of which is spectacular) and when viewing it on other monitors with a resoultion that isn't 1920x1080. The divs all seem
to move around etc. I've been using pixels, looked on the net and people say use % but i prefer using pixels, is there anything i can do to make it work?
01-12-2014, 09:50 AM
You have not posted a link or any code to give anyone any idea of what the cause is. E.g.
- Are you using a CMS, in which case which?
- Are you hand-crafting the code, in which case what "position:" setting are you using (or are you not setting it)?
a) Pixels may be preferable to % for columns of text, including vertical nav bars, but you need to use "position: absolute" consistently.
b) If you want graphics to dynamically re-size with the window (whilst retaining their aspect ratio) - set a % width (not height).
c) If you want graphics and/or text columns to re-size in steps - use media-specific style sheets, (or media queries).
If you are not familiar with "position:" or media-specific style sheets, look up a CSS reference like this.
Note: This may not be the answer you wanted, but there is no substitute for knowing what the CSS is doing, and how to set it up to do what you want.
01-12-2014, 09:56 AM
Hi, thanks for the reply
Yeah i'm doing this all by myself from scratch. Would the "Position: absolute" solve the problem? or is this due to that im using px?
01-12-2014, 02:07 PM
Position:absolute allows you to use the parameters top: and bottom:, left: and right: as well as width: and height: to fix the position of divs etc. with respect to the containing div. E.g.
To have three divs: a fixed height header full width, and one fixed width column beneath it and another occupying the remainder of the space you can use: