Jump to content

Recommended Posts

hello.

 

i would like to increase css padding by 5px every time there is 30 charactures in the text. how can i do this ?

 

this is what i have but its not any good .

 

$length = (strlen($article->title));
$padding = 5;

    	for ( $counter = 2; $counter <= 10; $counter += 10) {
    	$amount = $padding * $counter;
    	}

 

 

I don't think it would be such a good idea, because CSS is cached and won't be changed every time they visit a page with the same CSS.

 

If you really want to do it anyways:

http://php.net/manual/en/function.strlen.php

http://php.net/manual/en/function.file-put-contents.php

ok.

 

so is there another way. i.e everytime the line of text goes on to another row increase the padding by 5px

 

Could you show us the HTML and explain exactly what you want it to do?

 

CSS shouldn't be dynamically changed depending on the content in the html page, because it's cached by the browser, but the later versions of CSS allows you to do quite a lot of stuff. You also got JavaScript.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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