So I want it to display as Sampl...">

Html display div on the same line

I want to display text on my jsp page:

Sample date: <div id="sampleDate"/> 

So I want it to display as Sample date: 29-Aug-2012

But this happens as follows:

Sample Date:

29-Aug-2012

Can anyone help me with this?

+2
source share
3 answers

Write it like -

 Sample date: <span id="sampleDate"></span> 

I will not recommend this, but still, if you want to keep the DIV, then you have to make it an inline element -

 Sample date: <div id="sampleDate"></div> #sampleDate{ display: inline; } 
+2
source

css for sampleDate should be

 #sampleDate { display:inline; } 

You can also use float:left; for the selection date: and for the block #sampleDate float:right; put both blocks inside another block and set the width (then there will be no huge space between the two)

+2
source

You can use css ​#sampleDate{display:inline;}​ But you must use the @Dipaks method using the span tag.

Live View http://jsfiddle.net/WkNp8/1/

0
source

Source: https://habr.com/ru/post/957032/


All Articles