Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html display div in same line

Tags:

html

jsp

I wish to display a text on my jsp page:

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

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

But it is coming up like this:

Sample Date:

29-Aug-2012

Can anyone help me with this?

like image 866
DarkKnightFan Avatar asked Jan 01 '26 03:01

DarkKnightFan


2 Answers

Write it as -

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

I won't recommend this but still if you want to keep DIV then you have to make it inline element -

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

#sampleDate{ display: inline; }
like image 142
Dipak Avatar answered Jan 05 '26 19:01

Dipak


css for sampleDate should be

#sampleDate { 
   display:inline;
}

Also you could use float:left; for Sample date: and for #sampleDate block float:right; put both blocks inside other block and set width ( then there wont be a huge space between these two )


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!