having a special stylesheet for 800x600
having a special stylesheet for 800x600
am 24.08.2007 01:16:33 von WindAndWaves
Hi Folk
I was wondering if I could do the following:
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
My question is how I would write a regular expression that replaces as
follows:
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
Could you please help me to write this regular expression to test this
theory?
Thank you
Nicolaas
Re: having a special stylesheet for 800x600
am 24.08.2007 01:30:21 von Csaba
"windandwaves" wrote in message
news:1187910993.925507.262780@x40g2000prg.googlegroups.com.. .
> Hi Folk
>
> I was wondering if I could do the following:
>
> write a php function that changes a stylesheet from 1024x768 to one
> for 800x600 by literally changing all the widths, heights, font-sizes,
> etc... by the ratio between 800/1024 (i.e. multiplying all values to
> do with height or length with 0.78125)
>
> My question is how I would write a regular expression that replaces as
> follows:
>
> YYYpx to ZZZpx
> YYYem to ZZZem
> YYYpt to ZZZpt
> YYY% to ZZZ%
>
> where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
> Could you please help me to write this regular expression to test this
> theory?
>
> Thank you
>
> Nicolaas
>
Hi,
I dont understand why you want to do that.
Can you not change the dimensions to relative sizes (%)?
Richard.
Re: having a special stylesheet for 800x600
am 24.08.2007 01:31:16 von ivansanchez-alg
windandwaves wrote:
> [...] that changes a stylesheet from 1024x768 to one
> for 800x600 by literally changing all the widths, heights, font-sizes,
> etc... by the ratio between 800/1024 (i.e. multiplying all values to
> do with height or length with 0.78125)
Have two different style sheets with different base values on just the
element. Have a third (cascading) sheet with the rest of the
styling, express *everything* in either percentage or em. Problem solved
without touching a single line of code.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
Re: having a special stylesheet for 800x600
am 24.08.2007 02:28:28 von Jerry Stuckle
windandwaves wrote:
> Hi Folk
>
> I was wondering if I could do the following:
>
> write a php function that changes a stylesheet from 1024x768 to one
> for 800x600 by literally changing all the widths, heights, font-sizes,
> etc... by the ratio between 800/1024 (i.e. multiplying all values to
> do with height or length with 0.78125)
>
> My question is how I would write a regular expression that replaces as
> follows:
>
> YYYpx to ZZZpx
> YYYem to ZZZem
> YYYpt to ZZZpt
> YYY% to ZZZ%
>
> where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
> Could you please help me to write this regular expression to test this
> theory?
>
> Thank you
>
> Nicolaas
>
Or, better yet - don't used fixed sizes for your pages. Rather, have
pages which flow with the current window size (fluid window).
And just because my screen size is 1024x768 (or whatever) doesn't mean
my window size is. In fact, it almost never is. So your idea won't
work on my browser.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: having a special stylesheet for 800x600
am 24.08.2007 05:50:10 von WindAndWaves
thanks for all the replies.
Just out of curiosity. Do you know what the regular expression would
be?
Thank you
Nicolaas
On Aug 24, 12:28 pm, Jerry Stuckle wrote:
> windandwaves wrote:
> > Hi Folk
>
> > I was wondering if I could do the following:
>
> > write a php function that changes a stylesheet from 1024x768 to one
> > for 800x600 by literally changing all the widths, heights, font-sizes,
> > etc... by the ratio between 800/1024 (i.e. multiplying all values to
> > do with height or length with 0.78125)
>
> > My question is how I would write a regular expression that replaces as
> > follows:
>
> > YYYpx to ZZZpx
> > YYYem to ZZZem
> > YYYpt to ZZZpt
> > YYY% to ZZZ%
>
> > where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
> > Could you please help me to write this regular expression to test this
> > theory?
>
> > Thank you
>
> > Nicolaas
>
> Or, better yet - don't used fixed sizes for your pages. Rather, have
> pages which flow with the current window size (fluid window).
>
> And just because my screen size is 1024x768 (or whatever) doesn't mean
> my window size is. In fact, it almost never is. So your idea won't
> work on my browser.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Re: having a special stylesheet for 800x600
am 24.08.2007 10:15:08 von Toby A Inkster
windandwaves wrote:
> Just out of curiosity. Do you know what the regular expression would
> be?
It's not a task I'd even *attempt* using regular expressions. If I really
needed to programatically modify some CSS, I'd parse the stylesheet into
some sort of object structure, tweak the objects and then re-serialise
back to CSS. Complex work, but the only way that's going to cover all the
edge cases.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 64 days, 11:52.]
TrivialEncoder/0.2
http://tobyinkster.co.uk/blog/2007/08/19/trivial-encoder/
Re: having a special stylesheet for 800x600
am 24.08.2007 17:23:42 von gosha bine
On 24.08.2007 01:16 windandwaves wrote:
> Hi Folk
>
> I was wondering if I could do the following:
>
> write a php function that changes a stylesheet from 1024x768 to one
> for 800x600 by literally changing all the widths, heights, font-sizes,
> etc... by the ratio between 800/1024 (i.e. multiplying all values to
> do with height or length with 0.78125)
>
> My question is how I would write a regular expression that replaces as
> follows:
>
> YYYpx to ZZZpx
> YYYem to ZZZem
> YYYpt to ZZZpt
> YYY% to ZZZ%
>
> where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
> Could you please help me to write this regular expression to test this
> theory?
>
assuming your stylesheet is in the variable $css,
$css = preg_replace_callback('/\d+(?=\s*(px|em|pt|%))/', 'convert', $css);
function convert($m) {
return round($m[0] * 800 / 1024);
}
hope this helps
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Re: having a special stylesheet for 800x600
am 24.08.2007 23:07:06 von Good Man
windandwaves wrote in news:1187910993.925507.262780
@x40g2000prg.googlegroups.com:
> Hi Folk
>
> I was wondering if I could do the following:
>
> write a php function that changes a stylesheet from 1024x768 to one
> for 800x600 by literally changing all the widths, heights, font-sizes,
> etc... by the ratio between 800/1024 (i.e. multiplying all values to
> do with height or length with 0.78125)
>
wow cool, using CSS completely incorrectly!
CSS = a way for your pages to look good REGARDLESS OF SCREEN RESOLUTION
Programming for screen resolution puts you squarely back to 1996.