dongrandi8411 2016-05-31 07:08
浏览 57

Codeigniter视图:应用CSS

I am learning CodeIgniter and trying to apply some style in my view css selector(main_row). But when i run project, i only get data without any style.Why?

My code:

<html>
<head>
    <title>
        Test View
    </title>
    <style>
        .main_row {
            border: solid thin;
            background-color: greenyellow;
        }
    </style>
</head>


<body>
    <h1>Solr Result</h1>
    <table>
      <?php
       foreach ($data as $rows) {
           echo '<tr class="main_row">';
           echo '<tr><td>'.$rows['content'].'</td></tr>';
           echo '<tr><td>'.$rows['url'].'</td></tr>';
           echo '</tr>';
       }
       ?>
    </table>
</body>
</html>
  • 写回答

2条回答 默认 最新

  • dongya4089 2016-05-31 07:24
    关注
    <html>
    <head>
        <title>
            Test View
        </title>
        <style>
            .main_row {
                border: solid thin;
                background-color: greenyellow;
            }
        </style>
    </head>
    
    
    <body>
        <h1>Solr Result</h1>
        <table>
          <?php
           foreach ($data as $rows) {
               $html = "";
               $html .= '<tr class="main_row">';
               $html .=  '<td>'.$rows['content'].'</td>';
               $html .=  '<td>'.$rows['url'].'</td>';
               $html .=  '</tr>';
               echo $html;
           }
           ?>
        </table>
    </body>
    </html>
    

    Try this, should work

    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示