Aureole Posted August 1, 2007 Share Posted August 1, 2007 This is probably a stupid question but is there anyway to do like.... height: 100% minus x pixels...with CSS? I don't want to mess around with Javascript (unless its a cross-browser simple thing) so yeah, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/ Share on other sites More sharing options...
calabiyau Posted August 1, 2007 Share Posted August 1, 2007 no there is no way to mix pixels and percents in CSS, in a single declaration for a dimension Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-312938 Share on other sites More sharing options...
AndyB Posted August 1, 2007 Share Posted August 1, 2007 that's what padding or margin is for. Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-313270 Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 Padding and margin are indeed for this BUT they don't quite work as Aureole wants them to. Unfortuately you simply have to bite the bullet and if you use height 100% accept that any padding or margin will 'break' any layout where the boxes have borders and elements outside the document flow are present... its rare I find a GOOD use for %height! Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-313780 Share on other sites More sharing options...
Aureole Posted August 14, 2007 Author Share Posted August 14, 2007 Meh well I'm no CSS expert I use height % all the time. Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-323440 Share on other sites More sharing options...
ToonMariner Posted August 14, 2007 Share Posted August 14, 2007 Meh well I'm no CSS expert... thats why you are always using %height!!! Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-323487 Share on other sites More sharing options...
TheFilmGod Posted August 16, 2007 Share Posted August 16, 2007 Yes there is a way to do it. You can use php to go into the file and edit the parameters and then send the finished text to the browser and get it all to work. This would be dificult and a waste of time. As an alternative solution you can set a container div and then have multiple divs in the CSS. Then depending on the necessary parameters call a div according to that. Like <div id="container"> <div id="<?php echo $parameterdiv; ?>"> Content... content... </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-325375 Share on other sites More sharing options...
ToonMariner Posted August 16, 2007 Share Posted August 16, 2007 indeed filmgod - serverside can go and work all this out for you BUT - its it worth it? the extra processing is IMO pointless when you can just let a browser do its own thing and still look good... Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-325640 Share on other sites More sharing options...
deadimp Posted August 26, 2007 Share Posted August 26, 2007 Yes there is a way to do it. You can use php to go into the file and edit the parameters and then send the finished text to the browser and get it all to work. This would be dificult and a waste of time. It isn't that hard to have PHP pass through a css file. The hardest thing I've found about it is finding an IDE that can different from *.php and *.css.php masks so the highlighting doesn't collide (I ended up using *.phtml for PHP/CSS files, though some hosts might not have the extension defined for PHP). The main thing to keep in mind when using PHP with CSS is to make sure the browser knows that its mimetype is CSS, by using: header("Content-Type: text/css"); Of course, this won't exactly help you with your percentage dilemma. Kinda off-topic... Quote Link to comment https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-334708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.