Jump to content

styling HTML when in PHP


Pavlin24

Recommended Posts

Hallo,

can anybody help me about this questuon.

 

Is it possible to style HTML table heading, when it is in PHP? I mean something like this:

 

<?php

echo "<table border='1'>
<tr>
<th style='width:150px;'>дата на док.</th>
</tr>
</table> "
?>
This not work . I want to set width of the heading to be 150 px.
Is there other way?
Link to comment
Share on other sites

Add semicolon (;) to end of echo code.

It is better to use single quotes to contain text, also use a class to style the table header

<style type="text/css">            table, td, th {border: 1px solid #000;} /*style all tables, td , th */            .table01 th {width: 150px} /*only style table with class table01 th */        </style>

<?php

echo '<table class="table01">
<tr>
<th>дата на док.</th>
</tr>
</table>';
?>
Then if changes required you just edit stylesheet.
Edited by dsonesuk
Link to comment
Share on other sites

To Petrucho: No errors are shown. Everything works, except of styling the width of this column.

To dsonesuk: I have semicolon. I replaced the double quotes, I tried with class too, no result.

 

But I found that the same code placed in other file works!

I even copied the code from working file to not-working, but it still do not work in second file.

It is some kind of mystery.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...