I need some quick HTML help

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Stefan

Account Closed
Impact
0
Hey guys. I have a simple problem with displaying DIVS. This is my problem; I would like the two divs to be displayed together on one line without using tables (cause tables suck). Here is some example code:

Code:
<div>pwnz0rz!</div><div>pwnz0rzdoublaview!</div>

And this displays it like this:

Code:
pwnz0rz!
pwnz0rzdoublaview!

And I want it to display like this:

Code:
pwnz0rz! pwnz0rzdoublaview!

Does anyone know how I can solve this annoying, but probaly simple problem of mine?

+REP plus 1NP$ to whoever helps me. :hehe:

EDIT: Okay I found a way that works for this using CSS, but I'd like to know if there are any other ways of doing this. Here is what I came up with. I made a class called PWNAGE and it was like this:

Code:
.pwnage{ 
display: inline; 
}

So yeah that seems to work. Any other suggestions?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
There's another CSS way to do it..

Code:
div {
 float: left;
}
 
0
Close
Then would the div that I want to be displayed on the right side be
Code:
float: right;
?
 
0
Close
It could be, but it would be as right as possible. (?)

If you had another div around both with a set width, it would go all the way to the right. If they were just in the body, it would be all the way to the right of the page.

Making it float: left; puts it to the left like how you said you wanted it displayed.

The thing about display: inline; is that when you do that you can't set a width or other things that display: block; (which DIV's are) items can.
 
0
Close
HTML:
<div style='width: 20px;'>
<div>Hai2u</div>
<div style='flat: right;'>Blah</div>
</div>
 
0
Close
in <head></head>:
HTML:
<style type="text/css">
.div1 { display: inline; }
.div2 { dispay: inline; }
</style>
in <body></body>:
HTML:
<div class="div1">pwnz0rz!</div>
<div class="div2">pwnz0rzdoublaview!</div>
should work...
 
0
Close
Palyriot said:
in <head></head>:
HTML:
<style type="text/css">
.div1 { display: inline; }
.div2 { dispay: inline; }
</style>
in <body></body>:
HTML:
<div class="div1">pwnz0rz!</div>
<div class="div2">pwnz0rzdoublaview!</div>
should work...

Thats what i was going to say, i have had this problem before, its nothing big and bad!
 
0
Close
Why not just use one div? :-/
Code:
<div>pwnz0rz! pwnz0rzdoublaview!</div>
 
0
Close
Yeah I agree, just stick it all in one div and there should be no problems. However, if you must then use inline.
 
0
Close
I love tables :'(
 
0
Close
For Noobie:

Tables are crap

For Billy:

I'm sure that text was just an example and he really wanted two boxes or something and in that case, you would want two boxes.
 
0
Close
You probably need to use floats for 2 boxes.

I don't think inline would turn out to pretty if you use it for columns or boxes.
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back