Jump to content

PHP HTML Formatting


korki696

Recommended Posts

Hey all,

I am working on a site right now but I have a problem that I just cant figure out. What i am trying to do is have two echoes that are next to eachother but with different HTML formating.

 

<div class="additional_info ie6fix" id='twitterbox'>
<?php echo $feed[0]; ?>
<h2><?php echo $feed[1]; ?></h2>
<h4><?php echo $feed[2]; ?></h4>
</div>

 

So in that example lets say $feed[1] = "Hello " and $feed[2] = "Mom". I want the output to be Hello Mom. The output i currently get is:

Hello

Mom

with the different formatting. How can i get the two outputs on the same line?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/176483-php-html-formatting/
Share on other sites

heading tags automatically go to the next line. if you want to be next to each other you will have to set their float style, or some other display style try

<div class="additional_info ie6fix" id='twitterbox'>
<?php echo $feed[0]; ?>
<h2 style="float:left"><?php echo $feed[1]; ?></h2>
<h4 style="float:left"><?php echo $feed[2]; ?></h4>
</div>

 

I'm a little rusty on my CSS though, so that might be wrong

Link to comment
https://forums.phpfreaks.com/topic/176483-php-html-formatting/#findComment-930305
Share on other sites

echo $feed[0].', '.$feed[1];

 

the . attaches the two variables .. http://us3.php.net/manual/en/language.operators.string.php

 

using html <h> tags though, you will always get a line break as they are used for headers .. headers are standalone unless specified otherwise using CSS.

Link to comment
https://forums.phpfreaks.com/topic/176483-php-html-formatting/#findComment-930306
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.