How do I prevent DIV tag starting a new line?


I want to output a single line of text to the browser that contains a tag. When this is rendered it appears that the DIV causes a new line. How can I include the content in the div tag on the same line – here is my code.

  echo("<a href=\"pagea.php?id=$id\">Page A</a>") 
<div id="contentInfo_new">
  <script type="text/javascript" src="getData.php?id=<?php echo($id); ?>"></script>

I have tried to tidy it up here. How can I have this display on a single line?


The div tag is a block element, causing that behavior.

You should use a span element instead, which is inline.

If you really want to use div, add style="display: inline". (You can also put that in a CSS rule)

Answered By – SLaks

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.