View Full Version : em vs px
tomyknoker
03-30-2007, 07:22 AM
was wondering when and where it's good to use em's instead of pixels? i have been reading up on a few books and they all use em's, especially for padding, but it seems like a lot more work than just using a pixel value... any opinions/ideas would be appreciated!
Always. ems are relative units based off the user's font size which adjust themselves to the user's preferences, so they're always a better choice than pixels. However, be careful not to mix units for width.
tomyknoker
03-30-2007, 09:15 AM
What do you mean in the last sentecne? So your saying it's a bad idea to make a table 700px?
Yes. It doesn't take account of the user's preferences, and will look drastically different (possibly spoiling your design) at different resolutions and with different font sizes.
boxxertrumps
03-30-2007, 06:10 PM
its what im using for my site right now, was getting annoyed that it was huge on the school compters or really tiny when im at home...
Google ads dont support ems (or percents) so im stuck with the same thing...
take a look, (http://boxxer.mooo.com) if you change the font size the page adapts...
boxxertrumps, you're serving XHTML as text/html. Don't do that, and what's the deal with "IMMA CHARGIN MA LAZER?" :p
boxxertrumps
03-30-2007, 06:28 PM
Just random meams that the ads will read...
Not much text on my page, so it sometimes gets off topic...
But i keep forgetting to add the content header to the pages, thanks for reminding me.
<?php header("Content-type: application/xhtml+xml; charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
This is correct?
That's fine, although the <meta> is redundant.
boxxertrumps
03-30-2007, 06:43 PM
Aren't headers stripped by some firewalls?
I know the deal with xhtml, your reluctant to use it because of compatability issues...
But i was thinking of switchingover to pure xml, so id be able to define my own elements...
(basicly divs/spans, anchors, images and styles sheets.)
I dont use JS or much of anything else on my site, so it would probably work...
or i could edit the stuff i dont use out of the existing xhtml doctype declarations.
Dont know whatthe next step is for my site.
boogyman
03-30-2007, 06:56 PM
Originally Posted by My Source
<?php header("Content-type: application/xhtml+xml; charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
why not just take out the php scripting then ... there really is no need for it
boxxertrumps
03-30-2007, 07:02 PM
because if it has the extention html, im almost positive that it is sent with a text/html header.
(And i dont know how to change it...)
Aren't headers stripped by some firewalls?Not all headers, or HTTP wouldn't work at all :) The Referer is the one I usually warn about, although I'm sure there are others that get stripped too. Firewalls certainly wouldn't strip something important like Content-Type, and an HTTP header, if set, overrides any <meta> element on that page, so the <meta> will just be ignored.
I know the deal with xhtml, your reluctant to use it because of compatability issues...No, it's fine so long as you intend to drop IE support by sending the Content-Type header properly. Most people aren't, though.
But i was thinking of switchingover to pure xml, so id be able to define my own elements...XHTML already is pure XML. It's just one DTD. You can create more namespaces if you wish, and embed them, by extending the XHTML DTD to include an element that can be used to link to your namespace, as I understand it. As an example, see the W3C's XHTML+MathML+SVG DTD (http://www.w3.org/TR/XHTMLplusMathMLplusSVG/).
because if it has the extention html, im almost positive that it is sent with a text/html header.
(And i dont know how to change it...)You can use an AddType directive in your .htaccess:
AddType 'application/xhtml+xml; charset=UTF-8' xht xhtml
boxxertrumps
03-30-2007, 07:26 PM
I didn't know that IE refused to open xhtml docs. So ill just have it rendered as html...
<?php if (!strstr($_SERVER["HTTP_USER_AGENT"],"MSIE")) {
header("Content-type: application/xhtml+xml; charset=utf-8"); } ?>
bad form, but rewriting my entire site as html 4.01 would take quite a while.
You could always transform it using XSLT (http://www.stylusstudio.com/xsllist/200004/post10360.html).
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.