473,748 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

lining up blocks with display:inline;

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 other on the left three block
elements ("bouton") on top of the base line.

Here's what I tried:

#aa, #bb, #cc {width: 140px; padding-top: 3px; display: inline;}

<div class="bouton" id="aa">
<a href="../../index.html" title="">
<span class="a"><span class="b"><span class="c">
Foo A
</span></span></span>
</a>
</div>

<div class="bouton" id="bb">
<a href="../history.html" title="">
<span class="a"><span class="b"><span class="c">
Foo B
</span></span></span>
</a>
</div>

<div class="bouton" id="cc">
<a href="history03 .html" title="">
<span class="a"><span class="b"><span class="c">
Foo C
</span></span></span>
</a>
</div>

Without display:inline, the blocks appear correctly except that they
are stacked vertically. With display:inline they still stack
vertically and now with a width equal to that of the parent
container. What is going on? I can use float:left on the three blocks,
which then line up nicely, but below the parent container base line.

--

Haines Brown
KB1GRM
ET1(SS) U.S.S. Irex 482
Mar 25 '06 #1
5 2174
Sorry to follow up on my own question. After another half day browsing
on line, I came to realize I was suffering from a classic problem whch
is called the "containing floats" problem. It is that a floated block
is in effect removed from the containing block and so does not
contribute to its height. As a result, my horizontal row ofblocks
fell below the bottom margin of the containing block, the height of
which was governed by its text content.

I came across a hack that works, but would appreciate any criticism:

I followed the horizontal row of floated-left blocks with a <hr /> and
defined its style as:

hr {
display: block;
clear: left;
visibility: hidden;
margin: -0.1em 0;}

--

Haines Brown
KB1GRM
ET1(SS) U.S.S. Irex 482
Mar 26 '06 #2
Haines Brown a écrit :
[...] I came to realize I was suffering from a classic problem whch
is called the "containing floats" problem. It is that a floated block
is in effect removed from the containing block and so does not
contribute to its height. As a result, my horizontal row ofblocks
fell below the bottom margin of the containing block, the height of
which was governed by its text content.
True.
I came across a hack that works, but would appreciate any criticism:
I would rather recommend
http://www.positioniseverything.net/easyclearing.html.

(Please quote what you are replying to)

Haines Brown a écrit :
#aa, #bb, #cc {width: 140px; padding-top: 3px; display: inline;}

<div class="bouton" id="aa">
<a href="../../index.html" title="">
<span class="a"><span class="b"><span class="c">
Foo A
</span></span></span>
</a>
</div>
Please upload a test case, with the minimal markup that exhibits the
problem and real data to understand what you are trying to achieve, and
post that URL. (as a side note, widths expressed in pixels are usually
a bad choice for elements that contain text).
With display:inline they still stack
vertically and now with a width equal to that of the parent
container. What is going on?


What parent container? Any other CSS rule intervening?

Anyways, the width property is ignored for inline elements. "display:
inline-block" ought to be the code of choice for the effect you are after,
but "variable" browser support makes it indeed preferable to use floated
DIVs, as you did.

--
Daniel Déchelotte
http://yo.dan.free.fr/
Mar 26 '06 #3
Daniel Dichelotte <ma**********@f r.club-internet.invali d> writes:
Haines Brown a icrit :
[...] I came to realize I was suffering from a classic problem whch
is called the "containing floats" problem. It is that a floated block
is in effect removed from the containing block and so does not
contribute to its height. As a result, my horizontal row ofblocks
fell below the bottom margin of the containing block, the height of
which was governed by its text content.
True.
I came across a hack that works, but would appreciate any criticism:


I would rather recommend
http://www.positioniseverything.net/easyclearing.html.


Thank you for the URL, which was much better than what I was
trying to use. I had tried this pseudo element approach and failed,
but perhaps with this explanation of the containing floats problem it
will go better.
Haines Brown a icrit :
#aa, #bb, #cc {width: 140px; padding-top: 3px; display: inline;}

<div class="bouton" id="aa">
<a href="../../index.html" title="">
<span class="a"><span class="b"><span class="c">
Foo A
</span></span></span>
</a>
</div>


Please upload a test case, with the minimal markup that exhibits the
problem and real data to understand what you are trying to achieve,
and post that URL.


I am in the process of updating an old 1999 HTML document with
CSS. I'm not sure of your implied question, but all the SPANs serve to
decorate the button. This will make it clear:

http://www.hartford-hwp.com/sandbox/...history01.html

Since you asked to see the document, allow me to raise an OT
question. You will note that I have the text in a div of defined
width, which is not conventional practice. The only reason is that I
know the readability of text is reduced if lines are too long, and so
I limited their length. However, I need to change width to max-width.

--

Haines Brown
KB1GRM
ET1(SS) U.S.S. Irex 482
Mar 26 '06 #4
On Sun, 26 Mar 2006, Daniel Déchelotte wrote:
I would rather recommend
http://www.positioniseverything.net/easyclearing.html.


How about http://www.quirksmode.org/css/clearing.html ?
Mar 26 '06 #5
"Alan J. Flavell" <fl*****@physic s.gla.ac.uk> writes:
On Sun, 26 Mar 2006, Daniel Dichelotte wrote:
I would rather recommend
http://www.positioniseverything.net/easyclearing.html.


How about http://www.quirksmode.org/css/clearing.html ?


A very simple solution! Thank you. Works fine on galeon and firefox,
but I worry about other browsers (am in no position to check).

--

Haines Brown
KB1GRM
ET1(SS) U.S.S. Irex 482
Mar 26 '06 #6

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

Similar topics

2
12217
by: e n | c k m a | last post by:
Anyone know how to keep the list-style-image visible when using display: inline for a horizontal list? Also, how to possibly have the text a little higher than the list-style-image? I've referred to alistapart.com and their "Taming Lists" tutorial but it doesn't discuss this . Thanks in advance,
4
7736
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 uses this kind of block floating, they don't wrap to build a whole new line but instead get "hooked" at the left-most element being larger than the element right beside this "overflowing" element.
23
3159
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 0H0</p> <p class="Telephone">Telephone: 555-1234 </p> <p class="Fax">Fax: 555-4321</p> </div>
4
2376
by: txican | last post by:
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 {
5
1975
by: CES | last post by:
All, I was hoping that someone might be able to help me with a few questions on Aligning Block Elements properly... Basically I have a row that has a fixed width of 900px. Within the row their is a <Divthat I want to align to the Right hand side of the <Div id=” Container “>. That div <Div id=”items”needs to be able to expand and contract based on the amount of text that is held within the <p id="p1">. This example is as close as I can...
3
4931
by: Jannette | last post by:
I've got this to finally work in IE (its only taken me 2 days solid), but now mozilla isn't displaying the text on the same line as the image. I'm a newby at CSS, and I've think I've worked on trying to resolve this too long and now I'm totally lost. I've posted this up to a site: *************************Uploaded to SERVER ******************** www.onlinecreations.com.au/wtts/index.php like I said, works in IE but not Mozilla. I just...
11
16484
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 as I would like? I've been playing with the following selector in my attempts to get at the text portion: input + * {width:180px;} So far my attempts have produced weirdness in FF and nothing occurs in IE7. Although beyond the scope of this...
2
8686
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 with two divs to get them to render side by side: <div style="width:12em;border: 2px solid #EFCE8C; padding: 0.5em;display:inline;">abc</div> <div style="width:12em;border: 2px solid #EFCE8C; padding:
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.