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>
<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
you here using id for style and also using looping so, its for creating multiple table row id's. you just use given below code it will work fine.
`<html>
Test View .main_row { border: solid thin; background-color: greenyellow; } `
`<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>
`