473,395 Members | 1,471 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.

Yet another problem with inline-block

16
hello all,

i have very irritating problem with spans and firefox. I'm developing simple form designer, where user can drag and drop "components" (like labels, textboxes etc) on the form and save it for later use. it looks something like that:
http://www.dxlxb.com/vz/formdesigner.jpg

now, I need to display a span OR a div in a table cell when user drops a "control". the problem is that div takes all available space in a cell, so I've decided to go ahead with spans. everything works fine if span content is not wrapped in a cell. here are some examples:
http://www.dxlxb.com/vz/test.html
as you can see, option 2 is what I'm trying to achieve. could someone give me any idea how to create span or div which looks like option 2 in IE6+ and FF?

p.s. I've tried using divs instead of spans - as I understand I need to add float: left to force div not to take all available space, but then vertical alignment is very wrong.

thanks in advance.
Oct 9 '07 #1
14 1982
drhowarddrfine
7,435 Expert 4TB
'inline-block' doesn't work in Firefox so you must use the -moz version. inline-block' only works in IE when the contents are actually 'inline' such as text in a <p>. I don't think text in a <td> qualifies as such.

<span> works fine in all browsers so that won't be the issue.

Make sure you are testing with a strict doctype otherwise IEs broken box model may get in your way.
Oct 9 '07 #2
vytas
16
as I said - span doesn't work as I want in FF when text in it is wrapped. please review my testing page to see what I'm talking about.
Oct 9 '07 #3
drhowarddrfine
7,435 Expert 4TB
I think I understand now. You are trying to get the red outlines to wrap around the whole text? If so, you can still use a <div> but, since this is text, why don't you use a <p>? In both cases, you can just set margins, position absolute and to keep that to one spot inside the <td> while leaving room for the other things.
Oct 9 '07 #4
vytas
16
yes, exactly, I want outlines to wrap around the whole text. and actually I have no idea why I didn't try p tag - if p can be converted to inline block, that it's suitable for me. I'll try that and post another reply in case that won't work.
Oct 10 '07 #5
vytas
16
ok, I'm starting to rip my hair of - I'm trying to achieve something so simple, but can't make this work on FF.
I'll reformulate my question:
I need to display an inline-block object (span, p, div, whatever). since FF doesn't support inline-block, I'm using -moz-inline-stack. the problem is - if content in span or p is wrapped, FF shows only first line.
examples:
http://www.dxlxb.com/vz/test.html
in IE, tests #2, 3 and 4 are fine, thats exactly what I need. in FF though non of them works. how can I force FF show spanned content?

p.s. the reason I'm not using div is that divs take all available space, which is not what I need.
Oct 10 '07 #6
drhowarddrfine
7,435 Expert 4TB
But doesn't -moz-inline-block do what you want?
Oct 10 '07 #7
vytas
16
uuffff... finally I've managed to display what I need. I have one more question though:
two css definitions:
Expand|Select|Wrap|Line Numbers
  1.     display: -moz-inline-block;
  2.     display: inline-block;
and
Expand|Select|Wrap|Line Numbers
  1.     display: inline-block;
  2.     display: -moz-inline-block;
are not the same (IE behaves differently). could someone explain me why?
Oct 10 '07 #8
vytas
16
But doesn't -moz-inline-block do what you want?
DAMN IT!!!!!!!! -moz-inline-block DOESN'T work if I add text align on table cell. for example:
[HTML]<table>
<tr>
<td style="text-align: center">
<span style="display: -moz-display-block">test</span>
</td>
</tr>
</table>[/HTML]
in this case span will be block, and not inline block (i.e. will take all space available). if I remove text-align - everything works fine. any suggestions?
Oct 10 '07 #9
drhowarddrfine
7,435 Expert 4TB
Are you using a doctype?
Oct 10 '07 #10
vytas
16
indeed. I've tried all doctypes I found on this site:
http://htmlhelp.com/tools/validator/doctype.html
none of them helped.
Oct 11 '07 #11
drhowarddrfine
7,435 Expert 4TB
I'm just confused about what you are trying to do because I'm working on my own stuff. I don't understand why you say you must use inline-block and then it seems it must be under several other conditions. When I use the strict doctype, which is the only one you should always use, and -moz-inline-block, it appears to me to do what you want. However:

It might be best for you to restate the problem along with the conditions because wading through the other posts trying to piece it together isn't working.
Oct 11 '07 #12
vytas
16
right, I understand that my posts are chaotic. but my problem didn't change - I can't make inline-block work on FF. here's updated sample:
http://www.dxlxb.com/vz/test.html
as you can see, second test is NOT an inline-block in FF, because span takes all available space (in other words it's a block, not an inline-block). I have a strict doctype in my html, so if you could explain how to force FF show inline-block, I would be very thankful.
Oct 11 '07 #13
drhowarddrfine
7,435 Expert 4TB
Ah! Now I get it. And the answer is, I don't know, but I'll find out.
Oct 11 '07 #14
drhowarddrfine
7,435 Expert 4TB
So apparently FF does not do -moz-inline-block the exactly the same as a CSS2 inline-block behavior. To control the size of the block, you can just add 'width' and 'height' but I see that the text spills out of that. I've read that some people try something with 'table-cell' and 'table' in cSS but I don't know what.

Here's one thing I have in my notes but don't know from where:
inline-block could be substituted using the following:

overflow: auto;
display: block;
float: left;
margin: 0 auto;

the float property flushes block elements onto the same line. float elements are not acknowledged by surrounding block elements (separate block context) unless 'overflow: auto' property applied to those block elements.
Oct 11 '07 #15

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

Similar topics

3
by: Nicolas Payre | last post by:
Hi, I have the following SQL that I want to use to update a table. It doesn't work ! Does someone knows why? ** I Know it could be done easy with a CURSOR FOR LOOP, but still... Thanks for...
2
by: Sonny | last post by:
Hi experts, I am writing a small code to read input from a file, for example my input file is: X Y Z 26.0 28.0 0.0 32.0 8.0 0.0 My code is:...
9
by: tonysuper | last post by:
Probably i have problem with co/des : if i call functions wich returns farray, programs go seg fault. if i comment destructor.. programs work but do not free memory. Any suggestion? ...
8
by: Joseph | last post by:
I am attempting to create a function that will hide all SPANS within an ided DIV ="idMain", then only display one span, but this function gives an error when it gets to elChildElement as being...
1
by: mouli | last post by:
Hi all, i have an xml structure something like the given below one and i am facing problem in handling the contents inbetween CDATA, i mean the subtag '<inline-fig>' is printed as it is like this"...
3
by: shuisheng | last post by:
Dear All, If I define a virtual function to be inline, is it really inline? Or it is inline in some cases, and not in other cases. Would you please help me to look at the following case. ...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
8
by: Martin the Third | last post by:
Hi, I need some help! I'm writing an infinite-precision floating point library called ipfloat (I know infinite is a misnomer - but arbitrary was taken). A quick overview: I'm storing numbers as...
2
by: bingo | last post by:
Hi, All: I was really new to C++, so please forgive me if I asked stupid questions. I was trying to use this following Vector class(not written by me) to do some calculations : ...
1
by: Richard Tobin | last post by:
In article <eb4e5dda-302b-44cd-ba4e-ef09239d6a02@e2g2000hsh.googlegroups.com>, Rainer <wolf.rainer@gmail.comwrote: This will return the text descendants of the <lielements: ...
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...
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: 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
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
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,...
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...

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.