Jump to content

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

you can just set the font size.

<div class="additional_info ie6fix" id='twitterbox'>
<?php echo $feed[0]; ?>
<span style="font-size:large" ><?php echo $feed[1]; ?></span>
<span style="font-size:small" ><?php echo $feed[2]; ?></span>
</div>

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.