Sign in to follow this  
chrisdo

Zwei div's nebeninander ohne Zeilenumbruch?

Recommended Posts

Wie kann ich zwei Div's auf der gleichen Zeile haben??

Bei mir macht er immer einen Zeilenumbruch.

HTML-Code:
CODE
<div class="test1">Test1: </div><div class="test2">Blabla</div>


CSS-Code:
CODE
div.test1 { font-weight: bold; }
div.test2 { color: #FFFFFF; }

Share this post


Link to post
Share on other sites
<div>s sind Blockelemente, die naturgemäß in einer neuen Zeile beginnen. Mit display:inline kann man Blockelemente in Inline-Elemente umwandeln:

CODE

div.test1 { display:inline; font-weight: bold; }
div.test2 { display:inline; color: #FFFFFF; }

Share this post


Link to post
Share on other sites
Also ich mach das so:
CODE
<div style="padding-top:30px; text-align:left; float:left">test div1 </div>
<div style="padding-top:30px; text-align:right">test div2</div>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this