在PHP中包含DIV的CSS

时间:2013-04-05 10:04:29

标签: php css html

if(boothsizerGlobal ==  3){
    var cellWidth = 112;
    var cellHeight = 52;
    var innerDivElectricTop = 41; 
    var innerDivElectricLeft =  110;    
    $('.imgBox').css("background-image", "url(booth_top_images/5X20TOP.jpg)");
    $('.imgBox').css("width", "900px");
    $('.imgBox').css("height", "225px");
    sidewalls = 2;
    backwalls = 6;  

}

有人可以帮助我将上面的代码转换成PHP吗? 我的意思是如果我有条件,如何为DIV设置超过40的CSS?

由于

2 个答案:

答案 0 :(得分:1)

.imgBox
{
background:url(booth_top_images/5X20TOP.jpg) no-repeat; 
width:900px;
height:225px;
}

答案 1 :(得分:0)

好吧,你的原始代码没有任何意义,因为一半的声明变量甚至没有被使用。此外,为什么你想要将前端代码转换成这样的服务器端代码,php 而不是 ,这是正确的方法。这样做!

if(boothsizerGlobal ==  3){
    $cellWidth = '112px';
    $cellHeight = '52px';
    $innerDivElectricTop = '41px'; 
    $innerDivElectricLeft =  '110px';    
    $backgroundImage = 'url(booth_top_images/5X20TOP.jpg)';

    $divCode = '<div style="width: ' . $cellWidth . '; height: ' . $cellHeight . '; "';
    return $divCode

}