Page 1 of 1

how do I create a inline div

Posted: Fri May 30, 2003 12:40 pm
by owen
probably a pretty easy question but how do I create a div that work like how the <b> tag works?

I wanted to remove the <b> tags from the my html so I replaced them with <div style='font-style:bold;'>bold</div> . But after doing this the divs kept breaking the text into a new line. does anybody know how to fix this?

Posted: Fri May 30, 2003 12:45 pm
by twigletmac
Try:

Code: Select all

<div style="font-weight: bold;">bold</div>
Mac

no

Posted: Fri May 30, 2003 1:57 pm
by owen
that doesn't work I already know how to bold the text. run/look at how the below turns out I want to prevent that linebreak

Code: Select all

<HTML>
<BODY>
jhfjfd gkljfdhf djklhg f ldkhdglkfd lgk lkfdh glk fdlkg lkfd dflk ghlfdk lfd f<div style="font-weight: bold;">bold</div>fdjhvfdghfdkjgdfkj fdfdkjh fdkj dfkjh fdkj dfkjh dfkjh dfkjh fdjkhfdjkh fdjkh fdkj dfkjh dfkjhdfk
fdkjhdfkjhdfkjhdf
fdkjdfhkjdfhkjfdhkjfdhkjdfhfdjk
</BODY>
</HTML>

Posted: Fri May 30, 2003 2:05 pm
by nielsene
Why do you need a div? Why not use span? Or add display: in-line; to the div's style? (Might be inline not in-line)

it's fixed

Posted: Fri May 30, 2003 2:18 pm
by owen
yes, it works now :) - thanx nielsene

Code: Select all

<HTML> 
<BODY> 
jhfjfd gkljfdhf djklhg f ldkhdglkfd lgk lkfdh glk fdlkg lkfd dflk ghlfdk lfd f <div style="font-weight: bold;display: inline;">bold </div>  fdjhvfdghfdkjgdfkj fdfdkjh fdkj dfkjh fdkj dfkjh dfkjh dfkjh fdjkhfdjkh fdjkh fdkj dfkjh dfkjhdfk 
fdkjhdfkjhdfkjhdf 
fdkjdfhkjdfhkjfdhkjfdhkjdfhfdjk 
</BODY> 
</HTML>
the <div> deletes the spaces after the </div> tag but the span doesn't whats the deference between a <div> and a <span> tag?

Inline Div?

Posted: Tue Jun 10, 2003 6:30 pm
by qman
You might be better off using a class or span as indicated above. A Div is used to define block elements and should not really be used in the fashion you are using it in. :D