0

I'm just a starter in html/css and I don't really know what should I use , I made some sites using % and it looked good in the beginning on my laptop screen (wide) but when I accesed the site at school the site was all looking weird cause the width was smaller and the height was bigger.

So my question is : Should I use px instead of % and what would be a good width to make a site with px.

Andrew V
  • 522
  • 10
  • 24
  • 4
    This question will almost certainly be closed because there is no objective way to answer it. You could also consider using `em`s and `rem`s as a unit of measurement -- these are measurements relative to the size of the text. – i alarmed alien Oct 29 '14 at 14:40
  • 1
    This really isn't a good question for SO. There are resources out there to guide you. There is no right way - it depends on what you are trying to do. – disinfor Oct 29 '14 at 14:40
  • We can't awnser this since you could use both at the same time. And both seem fine to me, the only difference is that px is a preset size, while % would be a certain percentage of your page. and both could be used when needed. – Azrael Oct 29 '14 at 14:44
  • What you can do is make your site in percentages with a max-width. The max-width is set to a reasonable width for the most common largest viewport size (1200px is decent) AND so single columns are not super wide. Check out my profile for a lot of good tutorials. – Christina Oct 29 '14 at 14:48

2 Answers2

1

900 or 960 px is almost always the way to go for your main content. You can however use percentages for some parts of your websites.

Like stackoverflow, you could have a main bar on top which has a 100% span across the page, whilst your content (the questions/answers) are within the 960px grid.

Take a look at http://960.gs/

Keep in mind you should also have to consider other screen sizes, so it might be wise to look at responsive webdesign ( http://en.wikipedia.org/wiki/Responsive_web_design )

However, it's up to what you want to accomplish to make the right decisions on what to use.

Rik_S
  • 381
  • 4
  • 13
  • You are right. Responsive webdesign is even better. Have included it in the edit. – Rik_S Oct 29 '14 at 14:44
  • thanks I'll check responsive webdesign – Andrew V Oct 29 '14 at 14:47
  • There are so many widescreen monitors out there that 960px is starting to seem a bit dated IMO... now that we have well-supported media queries, and the mobile device market is getting so dominant, I think a responsive set-up is a must for a conscientious web designer. – i alarmed alien Oct 29 '14 at 14:49
  • Whilst there are a lot of widescreen monitors, lots of people still use monitors like 1366*768 or 768*1024. You can't just ignore them. – Rik_S Oct 29 '14 at 14:52
  • Nope, and there are also tablets and phones that have intermediate widths. That's why I say that a responsive set up is best. – i alarmed alien Oct 29 '14 at 14:53
1

Pixels: If you use pixels then, its an absolute measurement and will be rendered irrespective of the browser's window size.

Percentage: Percentage is a relative measurement which will be rendered with respect to the browser's window size.

If you want to show some element to always appear in a fixed size, then use pixels, else use percentage.

The answer about the good width for a website is very well answered here:

What is the best absolute width for a webpage?

Refer the following article too. It will be helpufull to you.

http://www.sitepoint.com/best-size-website/

Community
  • 1
  • 1
Rumin
  • 3,787
  • 3
  • 27
  • 30
  • that question is from six years ago--the range of screen sizes has increased massively since then, particularly in the mobile phone/tablet sector. The advice there is really no longer relevant. – i alarmed alien Oct 29 '14 at 14:54
  • Though it has been answered six years ago.... it contains various links which are pretty much helpufull..... – Rumin Oct 29 '14 at 14:57