473,573 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centering div in space next to floating element

I stayed up late working on a CGI script and spent some time
formatting my page with CSS. It looked fine in IE, which will be 95%
of my audience, so I went to bed. Got up and looked at it in Opera
and it's different and not what I wanted.

Take a look at <http://home.hiwaay.net/~lkseitz/hhs/rnb/>. I'm
concerned with the form and links in the dashed box in the middle of
the page. In IE, my "margin: auto" causes the div to center itself in
the space between the left of the page and the floating image to the
right. In Opera, the div is centered over the entire window. If the
window is sized down such that the form hits the floating image,
ugliness ensues.

The IE behavior is what I desire. Most of the relevent CSS
information is in the HTML itself. (The image's class is in
<http://home.hiwaay.net/~lkseitz/hhs/hhs.css>.) Any tips on the
proper way to get it? Thanks.

(And if anyone wants to tell me the proper way to style the table at
the bottom with CSS, rather than using HTML attributes, feel free to
speak up! But that's not my primary concern at the moment.)

--
lkseitz (Lee K. Seitz) .at. hiwaay @dot@ net
Believe in the Bible? Heck! I've SEEN one!
Jul 20 '05 #1
2 2194
In article <10************ *@corp.supernew s.com>, lk*****@see.my. sig
says...
Take a look at <http://home.hiwaay.net/~lkseitz/hhs/rnb/>. I'm
In IE, my "margin: auto" causes the div to center itself in
the space between the left of the page and the floating image to the
right.
Yes, there seems to be bug on IE.
Most of the relevent CSS information is in the HTML itself.
BAD. More ugly is that your CSS is 3 places, external file (good),
embedded (OK for tests), inline (hardly ever good idea)
Any tips on the proper way to get it? Thanks.
Easiest way is to wrap blue dashed bordered div to other div, and give
that new div margin-right same size as your image.

If you don't like having elements just for styling, use padding-right for
body etc. and negative margins on other stuff. I don't recommend. You
might also try margin for current div and putting border to its child
elements, but I don't think it will work with dashed border...
(And if anyone wants to tell me the proper way to style the table at
the bottom with CSS, rather than using HTML attributes, feel free to
speak up! But that's not my primary concern at the moment.)


tr:first-child {background:#66 6;color:#000}
tr:first-child > th + th {background:yel low;clor:#000;}
table {border-collapse:collap se}
td,th {border:3px ridge;}

In IE, does not work. Should work on Firefox and Opera, if Table is
marked up correctly. Replace complicated selectors with classes, and IE
should do it too.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 20 '05 #2
In article <MP************ ************@ne ws.individual.n et>,
Lauri Raittila <la***@raittila .cjb.net> wrote:
Yes, there seems to be bug on IE.
And it's always a pain when the IE bug ends up being the desired look.
8)
Most of the relevent CSS information is in the HTML itself.


BAD. More ugly is that your CSS is 3 places, external file (good),
embedded (OK for tests), inline (hardly ever good idea)


I tend to agree, but this is still a work in progress. This is also
the only place this particular style (the inlined dashed box) will be
used. The embedded styles I grabbed from another page from a
different "site" of mine. Which means I'm using it more than once and
should probably stick it in it's own stylesheet, as you say. Although
I think I changed the width, come to think of it.
Easiest way is to wrap blue dashed bordered div to other div, and give
that new div margin-right same size as your image.


Ah, just what I needed! Thanks. For some reason I always forget
about setting margins for things like this. Which is sad because I
used that technique on one of my sites. Although I'm not sure the
double div would have occurred to me.

And let me apologize for the HTML on that page. It's generated by a
script, which means there aren't nearly as many line breaks (not to
mention as much indenting) as there should be. I hadn't thought about
that when I posted.

--
lkseitz (Lee K. Seitz) .at. hiwaay @dot@ net
BBS flashback:
* SLMR 2.1a * This tagline is umop apisdn
Jul 20 '05 #3

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

Similar topics

7
2579
by: Erik Schulp | last post by:
Hi all, I am trying to get a CSS defined layout to center on the page, have tried doing this with the <center></center> tags but than everything is centered, including text etc etc. What should I put into the stylesheet so that, no matter what resolution the viewer's screen is set to, the layout is always displayed centered ? Erik Schulp
15
13485
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side with float. But I can't center two side by side divs. If I float them and give them auto margins, the auto margins are ignored. If I wrap the...
3
6108
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and Opera7 (it works fine in Firefox). Any ideas as to why and what I might do to fix it? I've set up a little demonstration of the problem here: ...
2
1878
by: Gnolen | last post by:
Hi again, Last time my server was down(as for many others I have heard), but now it is online again! I would be really really happy if someone could take a look at my problem a bit. I now have two problems...It is the difference between IE and FF.. Problem #1.
13
1944
by: Raffi | last post by:
Hi, We have an application that requires IE. We recently incorporated CSS scroll areas. The scroll fields are supposed to be centered. They are except for IE5 for the Mac. I have tried various suggestions on the net without any luck. I have the code for the whole page below. I've taken out all the Mac specific code that I tried and didn't...
3
4194
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a top level <divthen I can place it with CSS attribute 'left:', but this is a fixed offset. Is it possible to have a <divcentered in the browser window?...
5
4811
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up doing this demo with tables. The main problems are the vertical centering of the info area, and of the text inside the squares.
2
3036
by: rudicheow | last post by:
SHORT VERSION ============= I have a bunch of identical fixed-size single-celled tables that rest against each other horizontally thanks to "float:left". These tables are dynamically generated and the number of them can vary greatly. They are all contained within a parent table cell, which is centred on the page. But I am unable to find a...
4
4063
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on whose logged in, the menu, or course, displays different items, sometimes just two items, other times many more. If all menu items are displaying,...
0
7705
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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...
0
8077
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5601
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5294
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...
0
3739
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2224
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1316
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.