473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

having a special stylesheet for 800x600

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

Aug 23 '07 #1
7 1463

"windandwaves" <nf*******@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.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.
Aug 23 '07 #2
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
<bodyelement. 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.
Aug 23 '07 #3
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.
js*******@attglobal.net
==================
Aug 24 '07 #4
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 <jstuck...@attglobal.netwrote:
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
==================

Aug 24 '07 #5
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/0...ivial-encoder/
Aug 24 '07 #6
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
Aug 24 '07 #7
windandwaves <nf*******@gmail.comwrote 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.

Aug 24 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bal | last post by:
Hi, I am trying to generate a pdf using a XML file and rendering the page through XSL Stylesheet to a PDF. But the page has some special characters, as its for a chequ website. My Code below is...
7
by: Michael Hill | last post by:
I have a perl script that i use to render a html page. In that page i call out a stylesheet. If the user has a 800x600 display the fonts are really too big. Since screen resolution is a function...
5
by: Ben Bloom | last post by:
I'm new to XSLT, but everything I've read says this is the best approach to solving the XML->CSV problem. Based on some web reading, I came across the following XSLT code which appears valid, even...
7
by: Chris Podmore | last post by:
This is probably a stupid question but here goes anyway. What's the best way to design web pages that work in 640x480 or 800x600 and above? The pages I have created look fine in 800x600 or above...
9
by: gkountz | last post by:
Hi: I am brand new to css and a have a limited amount of working knowledge regarding HTMl. This is primarily from using Frontpage. I recently purchased Stylemaster, a css authoring program,...
1
by: Rich | last post by:
Hello, I have a child form in a parent MDI form. The childform is being shrunk and cannot be resized when screen resolution is 800x600. The end user who uses my app cannot see stuff on the...
22
by: RobClack | last post by:
I'm quite new to xml and xsl, so this could be quite simple. I have an xml file with some data in it and an xsl file to process it into a web page. What doesn't work is hyperlinks. I've read...
8
by: cutlass | last post by:
Need you assistance to anyone who is willing to offer. I have been working on this script and can't get it to work. The issue I'm having is the statement: function validateSender($Address)...
2
by: GloStix | last post by:
It's kind of an odd question but I have css stylesheet switcher on my website and it works and everything except since the flash banner I have is part of the html and the static image banner is part...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.