473,385 Members | 1,834 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,385 software developers and data experts.

HELP | How can I display DIVs block by block INLINE? | key: div display:inline

the HTML is:
----------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>foo</title>
<style type="text/css">
<!--
..b {
width:200px;
height:100px;
}
#one {
background: #900;
}
#two {
background: #090;
}
#three {
background: #009;
}
#four {
background: #099;
}
#five {
background: #909;
}
->
</style>
</head>
<body>

<div class="b" id="one">111111</div>
<div class="b" id="two">222222</div>
<div class="b" id="three">3333</div>
<div class="b" id="four">44444</div>
<div class="b" id="five">55555</div>

</body>
</html>
---------------------------------------------------
now, they dispaly like:
+-------------+
|11111 |
+-------------+
|22222 |
+-------------+
|33333 |
+-------------+
|44444 |
+-------------+
|55555 |
+-------------+

but I want it to display like:
+-------------+-------------+-------------+-------------+-------------+
|11111 |22222 |33333 |44444 |55555 |
+-------------+-------------+-------------+-------------+-------------+

so I added "display:inline" to .b:
..b {
display:inline; /*added*/
width:200px;
height:100px;
}

but the "width" and "height" are not working!
I mean, they display one by one, not block by block.

I need your help, thank you!

Feb 4 '06 #1
4 2353
On Sat, 04 Feb 2006 04:32:05 +0100, <tx****@gmail.com> wrote:

so I added "display:inline" to .b:
.b {
display:inline; /*added*/
width:200px;
height:100px;
}

but the "width" and "height" are not working!


Inline elements (or elements pretending to be inline) don't have a width
or height. If you want the block elements to keep a specific height and
width, you have to let them be block elements.

What you could try is to float them left. If you don't want a line break
to a new line if the viewport is too narrow to display them all in line,
you could wrap them in a containing div and add the property/value
'white-space:nowrap;'.

This layout is usually used for a menu bar. An example for a basic
horizontal menu bar you can find in
<URL:http://www.pretletters.net/_test/voorbeeld_horizontaal-menu.html>.
But I'm guessing this is what you might want, because you're not very
specific about the functionality it is you're adding to your page.
--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Feb 4 '06 #2
tx****@gmail.com wrote:
the HTML is:
Don't post code to the group, upload it, post the url
Subject: HELP | How can I display DIVs block by block INLINE? | key: div display:inline


If you have a question, make sure it's not just in the header, repeat it
in the message body.

Search the group's archive for "inline-block".

--
Spartanicus
Feb 4 '06 #3
thank you.
I will remind myself.

Feb 4 '06 #4
thank you.
I learned much.
the semi-manufactured goods:
http://blog.blogwhy.com/txican

Feb 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Danny | last post by:
I have a small <div> element which contains two text blocks - one within <h5> tags and the other within <p> tags. I don't want any extra line spacing between elements so use the display:inline...
4
by: Axel Dahmen | last post by:
Hi, current browsers don't support "display: inline-block;" and "display: inline-table;", resp. Thus I'm using "float: left;" to achieve a similar effect. Problem is that if a row of elements...
23
by: Mat | last post by:
<div id="container"> <div id="main"> <div id="header"> <p class="Address">123 Fake Street, </p> <p class="City">Crazy City, </p> <p class="Province">Ontario </p> <p class="PostalCode">H0H...
1
by: Jeff Thies | last post by:
I have a number of blocks of content (product items) that I want to wrap naturally at the end of the line. float: left has the unhappy habbit of stacking up where the lowest extending block is. I...
5
by: Haines Brown | last post by:
A much discussed issue, but I'm unable to get results. Using galeon as browser. I have a div, the bottem border of which is solid and serves as a base line. My aim is to line up next to each...
12
by: Vadim Guchenko | last post by:
Hello. I'm using the following code: <html> <head> <style type="text/css"> pre {display: inline;} </style> </head>
11
by: totalstranger | last post by:
I have a check box with let's say 20 elements. I would like to have it align as 4 columns, 5 rows. Without using a table and using understandable CSS is there any way to make the check boxes align...
2
by: Steve Richter | last post by:
I would like to use display:inline and other CSS attributes to build an entry form. Where the heading to the left of the text box is always a set width. It is not working so I am experimenting...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.