Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用CSS对TD%进行着色_Php_Html_Css - Fatal编程技术网

Php 使用CSS对TD%进行着色

Php 使用CSS对TD%进行着色,php,html,css,Php,Html,Css,我有下面的小提琴设置,我无法使琴杆变暗。它将在没有style=“width:10%”内联的情况下工作。是否有其他方法可以在html代码中完成此操作?谢谢 更新。我让这个工作: echo '</td><td class="graph"> <div class="bar green" style="width:'.$left.'%"></div>

我有下面的小提琴设置,我无法使琴杆变暗。它将在没有style=“width:10%”内联的情况下工作。是否有其他方法可以在html代码中完成此操作?谢谢

更新。我让这个工作:

echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo'
';
td图{
宽度:200px;
}
td.graph.bar{
高度:18px;
浮动:左;
}
格林先生{
背景:绿色;
宽度:10%;
}
瑞德先生{
背景:红色;
宽度:10%;
}
黄先生{
背景:橙色;
宽度:10%;
}

div扩展到其容器的宽度。您的表没有宽度,并且是DIV的容器。因此您的DIV也没有宽度


给你的桌子一个宽度。

div扩展到它们的容器的宽度。您的表没有宽度,并且是DIV的容器。因此您的DIV也没有宽度


给你的桌子一个宽度。

我不完全确定你拍摄的是什么,但这里有一个例子,你的代码已经清理干净,并且(我认为)工作正常。您需要表格有一个宽度(或填充数据),关闭div,并为红色样式添加高度。这可能不是您想要的,但它似乎符合要求

我不完全确定您的拍摄目的,但这里有一个示例,您的代码已清理完毕,并且(我认为)正常工作。您需要表格有一个宽度(或填充数据),关闭div,并为红色样式添加高度。这可能不是你想要的,但它似乎符合你的要求。我让这个工作:

echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo'
';
td图{
宽度:200px;
}
td.graph.bar{
高度:18px;
浮动:左;
}
格林先生{
背景:绿色;
宽度:10%;
}
瑞德先生{
背景:红色;
宽度:10%;
}
黄先生{
背景:橙色;
宽度:10%;
}

更新。我让这个工作:

echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo '</td><td class="graph">
                                    <div class="bar green" style="width:'.$left.'%"></div>
                                    <div class="bar yellow" style="width:'.$temp2.'%"></div>
                                    <div class="bar red" style="width:'.$right.'%"></div>';

td.graph{
    width: 200px;
}
td.graph .bar {
    height:18px;
    float:left;
}
.green {
    background: green;
    width:10%;
}
.red {

    background: red;
    width:10%;
}
.yellow {
    background: orange;
    width:10%;
}
echo'
';
td图{
宽度:200px;
}
td.graph.bar{
高度:18px;
浮动:左;
}
格林先生{
背景:绿色;
宽度:10%;
}
瑞德先生{
背景:红色;
宽度:10%;
}
黄先生{
背景:橙色;
宽度:10%;
}

如果您添加了一点内容并解决了宽度问题,还可以关闭打开的
div
元素。我不明白“阴影”是什么意思。你想要达到什么样的结果?顺便说一句:你错过了2个
在您的小提琴中。我需要它们在同一行上,表示条形图,而不是单独的行。如果您添加一点内容并解决宽度问题,效果很好:还可以关闭打开的
div
元素。我不明白“阴影”是什么意思。你想要达到什么样的结果?顺便说一句:你错过了2个<代码>在您的小提琴中。我需要它们在代表条形图的同一行上,而不是单独的行上。一如既往,如果这符合您的需要,我们非常感谢向上投票并接受:)一如既往,如果这符合您的需要,我们非常感谢向上投票并接受:)