Jump to content

Maths in CSS?


Aureole

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-313780
Share on other sites

  • 2 weeks later...

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>

Link to comment
https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-325375
Share on other sites

  • 2 weeks later...

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...

Link to comment
https://forums.phpfreaks.com/topic/62844-maths-in-css/#findComment-334708
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.