样式(宽度)属性中的php变量 [英] php variable in style (width) attribute

查看:24
本文介绍了样式(宽度)属性中的php变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 php echo,我想为 width 属性使用一个变量以避免需要 if 语句.我尝试使用此代码:

I have a php echo, and I would like to use a variable for the width attribute to avoid needing an if statement. I tried to use this code:

<?php echo variable; ?>

没用.

这是我的代码:

echo "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='25' aria-valuemin='0' aria-valuemax='100' style='width: (Variable)'>";

推荐答案

是否有效:

echo   "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='25' aria-valuemin='0' aria-valuemax='100' style='width: ".$variable."'>";

这篇关于样式(宽度)属性中的php变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆