Convert HTML CSS stylesheet into inline css+php script

Discussion in 'PHP' started by web-developer, Apr 26, 2011.

  1. #1
    I have html code like below

    
    
    <style>
         .mybarcode {position:absolute;width:2px;height:128px;background:#000;}
        </style> 
    
    <div class="mybarcode">
        <div style="margin-left:26px;"></div>
        <div style="margin-left:34px;"></div>
        <div style="margin-left:36px;height:48px;">
    
    
    PHP:
    And I want to replace "mybarcode" style into inline CSS.
    So now code look like below example


    
    
    
    
    <div style="position:absolute;width:2px;height:128px;background:#000;">
        <div style="margin-left:26px;"></div>
        <div style="margin-left:34px;"></div>
        <div style="margin-left:36px;height:48px;">
    
    
    PHP:
    Is that possible using any PHP Script ?
    If any one has idea so please give me some help

    Thanks
     
    web-developer, Apr 26, 2011 IP
  2. artus.systems

    artus.systems Well-Known Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    103
    #2
    You can do like this
    
    <?php 
    $myCssStyle = "position:absolute;width:2px;height:128px;background:#000;";
    ?>
    
    <div style="<?php echo $myCssStyle; ?>">
    <div style="margin-left:26px;"></div>
    <div style="margin-left:34px;"></div>
    <div style="margin-left:36px;height:48px;">
    </div>
    PHP:
     
    artus.systems, Apr 27, 2011 IP
  3. web-developer

    web-developer Member

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Yes your are on right way
     
    web-developer, Apr 27, 2011 IP