473,587 Members | 2,504 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 2197
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
2581
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
13489
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 two floated divs in another div, the two divs have no
3
6109
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: http://www.frostjedi.com/terra/dev/test.html It's set up to render in quirks mode to demonstrate that it...
2
1880
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
1947
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 work. Centering is done by a separate <div> tag. If anyone knows how to get the scroll area to...
3
4196
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? 2. Verticle centering in <div>
5
4813
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
3037
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 way of centering these table cells within the parent cell.
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, centering is not a problem but when only two items are displayed, the menu appears on the left hand...
0
8219
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
8349
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
7978
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
8221
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
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
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
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

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.