473,499 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Border Around Everything

I am trying to put a 7px border around a page. If the contents don't fill
up the viewport, then the border must appear all around the viewport. If
the page is larger than the viewport, then the border must wrap around the
contents. Both should result in the border around the complete page, no
matter the size, so that none of the bgcolor bleeds outside of it (ie. you
can never see or scroll outside of the border). I would have thought this
would be more common than it is, but anyway...

I am trying to keep to using a doctype, preferably XHTML strict, and I'm
trying to find a method that works in all major browsers. I have tried
styling the html, body, and a 'wrapper' div, and I have tried making each
side of the border a thin div as well. I have tried various ways including
display:table on the body. Some work, some don't - with a doctype.

I have tried wrapping the entire contents in a 100% width and height 1x1
table, and this is the best solution I have found thus far. However, it
only works if the browser is in quirks mode (no doctype specified). If I
specify any doctype using this method, it only works in MSIE 5.

I have read http://www.quirksmode.org/css/100percheight.html but the
author doesn't seem to have put much effort into his 'working' examples -
put a large table in there and it bleeds over the bottom border. Also, I'm
not sure about trusting someone's advice when he chooses to go for the
quirks mode solution - it completely excludes one browser, whereas
strict+body+html+100% is only buggy in one minorer (sp? :-)) browser. And
where are his gecko-based results?

Is there a best method of doing this that doesn't require to be in quirks
mode and doesn't require hacking for specific browsers?

I am testing on Opera 7.23, Firebird 0.7, MSIE 6 (latest updates), MSIE
5.01 (this IS the version that comes with Win98, right?). I have yet to
test with Netscape 4.x.

Cheers.

--

..

Jul 20 '05 #1
10 5116

"Vigil" <me@privacy.net> wrote in message
news:pa****************************@privacy.net...
I am trying to put a 7px border around a page. If the contents don't fill
up the viewport, then the border must appear all around the viewport. If
the page is larger than the viewport, then the border must wrap around the
contents. Both should result in the border around the complete page, no
matter the size, so that none of the bgcolor bleeds outside of it (ie. you
can never see or scroll outside of the border). I would have thought this
would be more common than it is, but anyway...

I am trying to keep to using a doctype, preferably XHTML strict, and I'm
trying to find a method that works in all major browsers. I have tried
styling the html, body, and a 'wrapper' div, and I have tried making each
side of the border a thin div as well. I have tried various ways including
display:table on the body. Some work, some don't - with a doctype.

I have tried wrapping the entire contents in a 100% width and height 1x1
table, and this is the best solution I have found thus far. However, it
only works if the browser is in quirks mode (no doctype specified). If I
specify any doctype using this method, it only works in MSIE 5.

I have read http://www.quirksmode.org/css/100percheight.html but the
author doesn't seem to have put much effort into his 'working' examples -
put a large table in there and it bleeds over the bottom border. Also, I'm
not sure about trusting someone's advice when he chooses to go for the
quirks mode solution - it completely excludes one browser, whereas
strict+body+html+100% is only buggy in one minorer (sp? :-)) browser. And
where are his gecko-based results?

Is there a best method of doing this that doesn't require to be in quirks
mode and doesn't require hacking for specific browsers?

I am testing on Opera 7.23, Firebird 0.7, MSIE 6 (latest updates), MSIE
5.01 (this IS the version that comes with Win98, right?). I have yet to
test with Netscape 4.x.


I've tried this, and I could never get it to work. Problem is, if the
element doesn't descend deep enough, the border won't get to the bottom. The
only way you can do this is to force it, say with a 750-pixel-high
transparent image along one side.
Jul 20 '05 #2
MH
> I am trying to put a 7px border around a page.

I have tried ...a 'wrapper' div, and I have tried making each
side of the border a thin div as well.


Did you try superimposing two backgrounds, one slightly smaller (7px) than
the other?
e.g. in the . CSS you would write;
DIV.backbig {
margin : 0px;
border : 0px;
padding : 7px;
background : #1C1887; <!-- dark blue -->
}
DIV.backsmall {
border : 7px;
padding : 7px;
background : #CCFFFF; <!-- light blue -->
}

and in the .page.htm itself you would write
<DIV class="backbig">
<DIV class="backsmall">
this will produce a dark blue border around a light blue background.

--------
MH

Jul 20 '05 #3
With doctype XHTML stricht, it only works in MSIE 5.

On Tue, 23 Dec 2003 16:36:27 +0100, MH wrote:
this will produce a dark blue border around a light blue background.


--

..

Jul 20 '05 #4
The 1x1 table only works in all tested browsers - except NN4 - if I
specify the doctype as HTML 3.2, but I'd prefer to use XHTML strict.

--

..

Jul 20 '05 #5
MH
> > this will produce a dark blue border around a light blue background.
With doctype XHTML stricht, it only works in MSIE 5.


OK, I did not try that, I used
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
and it works in Opera 7 and IE6
------
MH
Jul 20 '05 #6
On Tue, 23 Dec 2003 17:59:50 +0100, MH wrote:
OK, I did not try that, I used
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> and it
works in Opera 7 and IE6


Hmm, that's odd - if you put the
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" in the DOCTYPE,
it b0rks on everything but MSIE 5...

I guess I can just forget about it working in NN4.

--

..

Jul 20 '05 #7
On Tue, 23 Dec 2003 17:59:50 +0100, MH declared in
comp.infosystems.www.authoring.html:
With doctype XHTML stricht, it only works in MSIE 5.


OK, I did not try that, I used
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
and it works in Opera 7 and IE6


That's because that Doctype triggers Quirks mode. To trigger so-called
"Standards" mode, you need to include the URI (doesn't trigger Standards
mode in Gecko browsers, e.g. Mozilla), or use the Strict DTD. See
http://gutfeldt.ch/matthias/articles/doctypeswitch.html for a good overview
of doctype switching.
http://gutfeldt.ch/matthias/articles...tch/table.html may be more
directly relevant to the current thread.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #8
On Tue, 23 Dec 2003 10:03:21 -0500, Neal wrote:
I've tried this, and I could never get it to work.


With more experimentation I have gotten it to work, provided the content
isn't inside an absolutely positioned div. I can have a 1x1 table
surrounding the lot. I can put as little or as much content inside and the
table will expand with the amount of content. However, if that content is
inside a position:absolute div - even if 'position' is the only attribute
the div has - the table will not expand as the content grows.

--

..

Jul 20 '05 #9
Vigil <me@privacy.net> wrote in
news:pa****************************@privacy.net:
With more experimentation I have gotten it to work, provided the
content isn't inside an absolutely positioned div. I can have a 1x1
table surrounding the lot. I can put as little or as much content
inside and the table will expand with the amount of content. However,
if that content is inside a position:absolute div - even if 'position'
is the only attribute the div has - the table will not expand as the
content grows.


That's because absolutely positioned elements are taken out of the layout
flow, so they don't contribute any height or width to their containing
elements.
Jul 20 '05 #10
On Wed, 24 Dec 2003 00:05:15 +0000, Eric Bohlman wrote:
That's because absolutely positioned elements are taken out of the layout
flow, so they don't contribute any height or width to their containing
elements.


Aha. Must find a workaround, then. Cheers.

--

..

Jul 20 '05 #11

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

Similar topics

3
9077
by: Mudcat | last post by:
Hello, I would like to change the color of the default border around frames or widgets. Note: not the highlight border, but the default border. There have been many previous requests about the...
2
2680
by: Michael Winter | last post by:
I have the familiar 'thumbnail' scenario. I want to place a small border around the image when the cursor hovers above it. I use a 1 pixel, solid border around the image that changes between normal...
3
29005
by: Frostillicus | last post by:
I work with Interwoven TeamSite in an environment where I do not have access to customise the default stylesheet, so the only option available to me is to specify an additional stylesheet wherein I...
7
41717
by: Bob Bedford | last post by:
I've an image in a cell of a table. I've this CSS: ..dbtable{ width: 600px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; border-collapse: collapse; border: 1px solid #000000;
23
52086
by: Bob Bedford | last post by:
I've a table. The table must not have any border. The TR (every line) must have a border, but not the lines between cells. The TR.pages must have no border. so .mytable{border:0px;} ...
0
1445
by: Phill | last post by:
I have a scrollable control I'm working on. Some parts of the painting I want to always be in the same position like my border. But when I hit the scroll bars my border moves. I dont't understand...
2
3005
by: tradmusic.com | last post by:
Hi, I'm new to CSS and, following some advice, created my page like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>...
8
12082
by: UJ | last post by:
I have a table with multiple cells and I want to draw a box around the entire table but not around the individual cells. How do I do that? TIA - Jeff.
1
2027
by: alicanteman | last post by:
Hi all, I am currently working on a website and until recently everything was working fine on both IE 6, IE7 and Firefox V. 2.0.0.11 However, when i changed the footer heading to "Design by...
0
7131
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
7174
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
7220
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...
1
6894
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...
0
7388
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...
0
4600
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...
0
3099
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...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
297
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...

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.