ricky spires Posted September 4, 2012 Share Posted September 4, 2012 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; } Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/ Share on other sites More sharing options...
MMDE Posted September 4, 2012 Share Posted September 4, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/#findComment-1375090 Share on other sites More sharing options...
ricky spires Posted September 4, 2012 Author Share Posted September 4, 2012 ok. so is there another way. i.e everytime the line of text goes on to another row increase the padding by 5px Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/#findComment-1375092 Share on other sites More sharing options...
MMDE Posted September 4, 2012 Share Posted September 4, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/#findComment-1375095 Share on other sites More sharing options...
ricky spires Posted September 4, 2012 Author Share Posted September 4, 2012 ok. im not good with javascript. do you have an example please. thanks Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/#findComment-1375101 Share on other sites More sharing options...
MMDE Posted September 4, 2012 Share Posted September 4, 2012 ok. im not good with javascript. do you have an example please. thanks We need a better example of exactly what you want. Give us some code we can help you with. Quote Link to comment https://forums.phpfreaks.com/topic/267984-increase-padding-by-5-every-30-charactures/#findComment-1375105 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.