Welcome to the Cookbook

loading...

7.4.1.5 style

style(array $data, boolean $oneline = true)

Builds CSS style definitions based on the keys and values of the array passed to the method. Especially handy if your CSS file is dynamic.

<?php echo $this->Html->style(array(
    'background'     => '#633',
    'border-bottom' => '1px solid #000',
    'padding' => '10px'
)); ?>
  1. <?php echo $this->Html->style(array(
  2. 'background' => '#633',
  3. 'border-bottom' => '1px solid #000',
  4. 'padding' => '10px'
  5. )); ?>

Will output:

  background:#633; border-bottom:1px solid #000; padding:10px;