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

inline-block: Are things really this bad?

Any suggestions? I want a sequence of composite "blocks" (e.g. image
and caption representing a product category) to wrap like text as a
browser is made wider/narrower. Tables are not working well for this
application. Any fixed choice of column numbers is always the wrong
choice!

I looked up about CSS block flow , found "display:inline-block;" and
thought problem solved - till I tested in IE & FF. Nightmare!!! After
*much* fiddling I have managed some code that seems to "work" robustly
in FF & IE. (example at http://mtoto.org/bits/flow-test.html). - But it
doesnt validate 'cos I had to put a <div> inside a <span>! Tomorrow I
might try using <li> in place of the outer <span> to see if that at
least avoids the div-inside-span hack.

There must be an easier way to "in-line" arbitrary blocks! If you know
it please tell me.

Nov 4 '05 #1
15 2313
"otto" <ic*****@verycool.co.uk> wrote:
Any suggestions? I want a sequence of composite "blocks" (e.g. image
and caption representing a product category) to wrap like text as a
browser is made wider/narrower.


http://www.spartanicus.utvinternet.i...h_captions.htm

--
Spartanicus
Nov 4 '05 #2
In article
<u2********************************@news.spartanic us.utvinternet.ie>,
Spartanicus <in*****@invalid.invalid> wrote:

[...]
http://www.spartanicus.utvinternet.i...h_captions.htm


2 comments:

- Yes, iCab 3 supports inline-block

- What makes you think iCab has anything to do with KHTML? iCab has its
very own rendering engine.

This is weird. Your site is the second I see today that says iCab is
KHTML based. <http://www.publish.com/article2/0,1895,1881400,00.asp> is
the other one. I wonder where that comes from. Some confusion due to
both of them passing Acid2 at more or less the same moment perhaps?

--
Sander Tekelenburg, <http://www.euronet.nl/%7Etekelenb/>
Nov 4 '05 #3
Sander Tekelenburg <us**@domain.invalid> wrote:
- What makes you think iCab has anything to do with KHTML? iCab has its
very own rendering engine.


Odd mistake, I knew that.

--
Spartanicus
Nov 4 '05 #4
Spartanicus wrote:
http://www.spartanicus.utvinternet.i...h_captions.htm


Thanks for that pointer and nicely written up too. Would that work for
arbitrary content though? I would welcome your criticism of my current
solution:-

http://mtoto.org/bits/flowing-galleries.html

'fraid I havent written it up but I have commented the html source it
if you have a moment to look.

Nov 4 '05 #5
"otto" <ic*****@verycool.co.uk> wrote:
http://www.spartanicus.utvinternet.i...h_captions.htm
Thanks for that pointer and nicely written up too. Would that work for
arbitrary content though?


To get the caption width to match the images the size of the image needs
to be specified in the CSS. There is no realistic way around that.

Other potential problems are described in the article.
I would welcome your criticism of my current
solution:-

http://mtoto.org/bits/flowing-galleries.html


I don't see the point of bothering with inline-block unless the aim is
to center the image/caption combos (your demo left aligns for me).

--
Spartanicus
Nov 4 '05 #6
Spartanicus wrote:
To get the caption width to match the images the size of the image needs
to be specified in the CSS. There is no realistic way around that.
I was really meaning: Would your CSS work for *any* type of element not
just different width pictures - a set of tables say?
I don't see the point of bothering with inline-block unless the aim is
to center the image/caption combos
How else? I am new to CSS but float: seemed very unpredictable unless
you pre-fix the height of all elements. And it can have unexpected
side-effects on following elements in my experience. In any case...
(your demo left aligns for me).


Only cos I chose the default to left align - thats the point. This CSS
is not just crafted for one gallery with one type of content (e.g.
pictures) in mind but to provide a common framework for *all* our
galleries *whatever the content*.

With the flick of a switch (aka CSS overide) a gallery can be centered
or right aligned. E.g. the little nested gallery is in fact center
aligned - it uses the exact same CSS classes as the main gallery.

Nov 4 '05 #7
p.s. I beleive my solution top aligns properly (even in gecko).

Nov 4 '05 #8
"otto" <ic*****@verycool.co.uk> wrote:
To get the caption width to match the images the size of the image needs
to be specified in the CSS. There is no realistic way around that.


I was really meaning: Would your CSS work for *any* type of element not
just different width pictures - a set of tables say?


Using tables instead of the images would produce hopelessly invalid
code.

To get tables to display inline there is the "inline-table" value for
the display property. Support for this value is even worse than for
"inline-block", despite the fact that inline-table is part of the CSS2.0
rec published in 1998.
I don't see the point of bothering with inline-block unless the aim is
to center the image/caption combos


How else? I am new to CSS but float: seemed very unpredictable unless
you pre-fix the height of all elements. And it can have unexpected
side-effects on following elements in my experience.


You're right actually, inline-block coding is the most appropriate way
to code this regardless of alignment.

--
Spartanicus
Nov 4 '05 #9
thanx. The more I look into this CSS stuff the messier it all seems.
Surely the block containement & flow model is absolutely fundamental to
any layout styling framework?

What on earth is the need for a special "inline-table"? Why not just
allow any element to be inline or cause a break?

Nov 4 '05 #10
"otto" <ic*****@verycool.co.uk> wrote:
What on earth is the need for a special "inline-table"?


Elements generated by display:inline-table participate in the CSS table
model, elements generated by display:inline-block do not.

--
Spartanicus
Nov 4 '05 #11
Fri, 04 Nov 2005 16:14:13 GMT from Spartanicus
<in*****@invalid.invalid>:
"otto" <ic*****@verycool.co.uk> wrote:
http://www.spartanicus.utvinternet.i...h_captions.htm


Thanks for that pointer and nicely written up too. Would that work for
arbitrary content though?


To get the caption width to match the images the size of the image needs
to be specified in the CSS. There is no realistic way around that.


IMHO this is one of the very few times where inline styles make
sense:
<div class="captionedimage" style="width:218px"><img
width="218" ... ><p>caption</p></div>

If there's something wrong with the above, I hope someone will pick
holes in it.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Nov 4 '05 #12
Anyone know why "display:inline-block" appears to work on a <span> but
not on a <div> in IE?

If I use <div> for the outer elements in my experiment (at
http://www.mtoto.org/bits/flowing-galleries.html) then IE behaves as if
they were display:block (i.e. they break the line) even though they are
explicitly inline-block. This has forced me to put a <span> illegally
around the <div>s (or other block elements) that I want to flow .

Surely this cant be right? I must have got the wrong end of the CSS
stick. How should one get arbitrary xhtml elements (logical tables for
example) to flow?

Nov 7 '05 #13
Anyone know why "display:inline-block" appears to work on a <span> but
not on a <div> in IE?

If I use <div> for the outer elements in my experiment (at
http://www.mtoto.org/bits/flowing-galleries.html) then IE behaves as if
they were display:block (i.e. they break the line) even though they are
explicitly inline-block. This has forced me to put a <span> illegally
around the <div>s (or other block elements) that I want to flow .

Surely this cant be right? I must have got the wrong end of the CSS
stick. How should one get arbitrary xhtml elements (logical tables for
example) to flow?

Nov 7 '05 #14
"otto" <ic*****@verycool.co.uk> wrote:
Anyone know why "display:inline-block" appears to work on a <span> but
not on a <div> in IE?


http://homepage.ntlworld.com/spartan...block_hack.htm

--
Spartanicus
Nov 7 '05 #15
Spartanicus wrote:
"otto" <ic*****@verycool.co.uk> wrote:
Anyone know why "display:inline-block" appears to work on a <span> but
not on a <div> in IE?

http://homepage.ntlworld.com/spartan...block_hack.htm


Thanx - another neat article. Unfortunately I couldn't work out how to
make this hack coexist with FF (it has side-effects on formatting that
I didnt/couldnt predict or control).

For the time being I will stick to my own hack which I claim doesnt so
much rely on bugs (IE or FF) as mitigate them - at the expense of some
(xhtml-illegal) pollution of the html. At any rate it now behaves
exactly as I expect and gives me precise and predicatable control over
formatting in both IE and FF.

Nov 8 '05 #16

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

Similar topics

2
by: qazmlp | last post by:
// test.h class test { public : inline void check() ; } ; // test.C inline void test::check() // Is 'inline' optional here?
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...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
7
by: Srini | last post by:
Hello, Rules for inline functions say that they have to be defined in the same compilation unit as their declarations. For class member functions this means that the inline member functions must...
5
by: Tony Johansson | last post by:
Hello experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. Here is the whole section: It says" Because...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
2
by: evan | last post by:
Hi, I've got an easy one... I need to inline a few functions from one module to another. By looking at the compiled code I can see that the function is inlined if it is called from within the...
15
by: niklaus | last post by:
Hi, I have a doubt regarding inline functions. 1) When does the inline of function happen. During the preprocessing stage or just before the object code is produced. Can we see the source code...
9
by: Martin Wells | last post by:
Is there anything like __inline_is_supported to indicate whether a certain C compiler supports inline? I'm writing my code as fully portable C89, but I want to use inline. Martin
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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...

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.