How to prevent adding a div tag to a new line?

I want to output one line of text to the browser containing the tag. When this is displayed, it appears that the DIV calls a new line. How to include content in a div tag on the same line - here is my code.

<?php 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> </div> 

I tried to put it in order. How can I display this screen on one line?

+59
html css
Dec 01 '09 at 2:58 p.m.
source share
7 answers

The div tag is the block element that causes this behavior.

Instead, you should use a span element that is inline.

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

+106
Dec 01 '09 at 15:01
source share

I am not an expert, but I will try white-space:nowrap;

The white-space property is supported in all major browsers.

Note. The value "inherit" not supported in IE7 and earlier. IE8 requires !DOCTYPE . IE9 supports "inherit" .

+20
Oct 31 '13 at 17:07
source share

div is a block element that always takes its own line.

use span tag instead

+14
Dec 01 '09 at 2:59 p.m.
source share

use float: to the left of the div and link or use a range.

+4
Dec 01 '09 at 15:00
source share

Add style="display: inline" to your div.

+3
Dec 01 '09 at 15:00
source share
 <div style="float: left;"> <?php echo("<a href=\"pagea.php?id=$id\">Page A</a>") ?> </div> <div id="contentInfo_new" style="float: left;"> <script type="text/javascript" src="getData.php?id=<?php echo($id); ?>"></script> </div> 
-one
Dec 01 '09 at 15:00
source share

You can simply use:

 #contentInfo_new br {display:none;} 
-one
Mar 24 '16 at 10:11
source share



All Articles