473,395 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to put two divs in one line?

9
Hi,everyone!

I want to put two divs in one line,but my code didn't work...

here is my code:
exp.html
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <link rel="stylesheet" type="text/css" href="exp.css">
  4.  
  5.     <head>
  6.     </head>
  7.  
  8.     <body>
  9.         <div id="headerimg">
  10.             <div id="logo">
  11.                 <div id="l1">l1
  12.                     <div id="l2">l2</div>
  13.                 </div>
  14.  
  15.             </div>
  16.             <div id="title">gbstack</div>
  17.         </div>
  18.     </body>
  19.  
  20. </html>
  21.  
exp.css
Expand|Select|Wrap|Line Numbers
  1. #headerimg{
  2.     width:100%;
  3. }
  4.  
  5. #logo{
  6.     width:30%;
  7.     background:red;
  8. }
  9.  
  10. #l1{
  11.     width:50%;
  12.     background:#aaaaaa;
  13. }
  14.  
  15. #l2{
  16.     width:50%;
  17.     background:#aa00cc;
  18. }
  19.  
  20. #title{
  21.     width:70%;
  22.     background:green;
  23. }
  24.  
I want to put l1 and l2 in one line.
any suggestion is appreciated.
Attached Images
File Type: jpg scrn.jpg (3.1 KB, 445 views)
Jun 26 '10 #1
5 6968
sidooh
9
any one could help me?
Jun 28 '10 #2
JKing
1,206 Expert 1GB
Divs are by default block elements. Use display:inline; in your css for both divs.
Jun 28 '10 #3
sidooh
9
Thank you very much!
It works!

Thank you again!
Jun 28 '10 #4
@sidooh
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <div align="left"  style="width:200px; top:0px; position:absolute">hi</div><div  style="left:220px;top:0px; position:absolute">hello</div>
  4. </body>
  5. </html>
Jul 1 '10 #5
<code>
<div style="float:left;height:200px;width:400px"> jadsklfj;adkfj;</div>
<div style="float:left;height:200px;width:400px;">ajljd fakljdf;kajdf</div>
</code>

Bharat Parmar(Bharat383)
May 1 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Egon Pasztor | last post by:
Hi. I'm new at CSS, so maybe this is obvious, but I've looked around quite a bit looking for a solution. I'm playing with the vertical positioning of elements in a 2-column layout. The...
6
by: Mel | last post by:
i need to have as many as 5 divs side by side on the same line without a break. if browser displays a horizontal scrollbar, its ok with my users and they can resize it. something like the...
2
by: Arnost Sobota | last post by:
Hello, Suppose I want to play with DIVs as if they were type characters. I have a series of fixed-height (width is of no importance) blocks which must follow one another from left to right, with...
7
by: massic80 | last post by:
Hi everybody! I'm making a page for an exam at uni. In two DIV blocks of it there should appear (and disappear) some "icons", due to XML messages, so I dunno how many of them should I can obtain;...
1
by: judacris | last post by:
I've seen the threads here about molding 2 divs in a centered fashion. but I can't seem to solve this thing. my blogger blog is functioning well on my site for now, but the blog feed (left) and...
3
by: Adam | last post by:
What would be the best way to make four roughly square divs line up in a horizontal row on a page? I've tried display:inline; with no luck (it just destroyed the box shape) and at the moment I've...
4
by: Adam | last post by:
I have four roughly square DIVs, all the same height, which I need to line up horizontally across the page. What would be the best way to do this? At the moment I have a very botched solution where...
7
by: maya | last post by:
hi, I got this unusual design (well, not so unusual anymore, I guess..) for an input text field for a search form in top of page.. http://www.mayacove.com/design/search/search.html I can't...
21
by: daydream | last post by:
yeah i need some help(such a common line) ,i have a menu and each link has its own div respectively and yeah obviously when u click the link the div shows, the problem is i would like each div to...
1
by: pxlcreations | last post by:
This is confusing me like crazy. I am making a webapp for the iPad but I can't seem to figure out how to keep my divs in a line, then have overflow-x kick in once the divs have hit the edge of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.