473,573 Members | 3,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Screen Overrun

Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort of
"body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the height
& width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm
Jul 20 '05 #1
2 2654

"Richard" <so**@where.com > wrote in message
news:6t******** ************@ne ws04.bloor.is.n et.cable.rogers .com...
Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort of
"body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the height & width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm

Hi Richard,
Not quite sure what yo are trying to achieve with negative margins and
absolute positioning here.
I'm not good at explaining things but here goes:
In #main
replace position:absolu te with position: relative.
delete left:50% & top:50%;
replace margin-left:-320px; & margin-top:-240px; with margin:50px auto;
And delete body>#main { margin-left:-320px; margin-top:-240px;}

so you have

position:relati ve;
width:640px;
height:480px;
margin:50px auto;
padding:0px;
border:2px solid black;
background-color:transpare nt;
text-align:center;
z-index:2;

Seems to work:)

Jul 20 '05 #2

"Carl Durbridge"
"Richard"
Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort of "body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the

height
& width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm

Hi Richard,
Not quite sure what yo are trying to achieve with negative margins and
absolute positioning here.
I'm not good at explaining things but here goes:
In #main
replace position:absolu te with position: relative.
delete left:50% & top:50%;
replace margin-left:-320px; & margin-top:-240px; with margin:50px auto;
And delete body>#main { margin-left:-320px; margin-top:-240px;}

so you have

position:relati ve;
width:640px;
height:480px;
margin:50px auto;
padding:0px;
border:2px solid black;
background-color:transpare nt;
text-align:center;
z-index:2;

Seems to work:)


Thanks, but it only works with regard to centering the div relative to left
and right. I am also looking for centering relative to top and bottom, where
the div is perfectly centered in the middle of the screen.
Jul 20 '05 #3

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

Similar topics

1
1843
by: Alan Clark | last post by:
Hello Everyone. I gave up on frames, and now I'm trying to achieve the same navigation with CSS - which is probably not the best idea. I've hit a strange snag. I've positioned a top banner DIV at 2% left and width of 96% absolute. Underneath, I have three DIV columns, the first at 2% left, width 27%, the second at 31% left, width 38%,...
8
3875
by: spoc | last post by:
I am using VC++6 and Numega bounds checker and have been getting many STATIC MEMORY OVERRUN errors (boundschecker) while trying to track down bugs. An example is below: void func() { static int midSection; memset(&midSection, 0, sizeof(midSection)); }
4
5643
by: David Sworder | last post by:
Hi there, I come from a Visual C++ background. When writing a service that's exposed to the Internet, I had to check the incoming data stream (from the client) VERY carefully. If a hacker was able to overflow one of the memory buffers in my app, he was then able to execute code of his choosing within the security context of the service....
1
1644
by: John Hensley | last post by:
There are a couple of bugs in the atlpath.h file that ships with DevStudio 2003 and DevStudio 2005 Beta 1 & 2. These bugs result in buffer overrun and memory corruption problems. After experiencing some memory corruption I traced the problems to CPathT::AddBackslash() and CPathT::Append(). These are offending lines in each of the functions...
8
2817
by: Martin Eisenberg | last post by:
Hi, If I want to terminate a program upon finding that sprintf has overrun its output buffer, should I prefer exit or abort from cstdlib? Thanks. Martin --
0
1471
by: Lonewolf | last post by:
Hi I'm faced with a very pesky problem. I have a managed assembly done in C++/CLI which interface to native C++ codes, and a C# app which consumes this assembly. I realize that when both the app adn assembly are in release mode, running in the VS IDE by pressing F5 with the active config set to release, it was able to work flawlessly....
0
1640
by: Anthony Baxter | last post by:
SECURITY ADVISORY Buffer overrun in repr() for UCS-4 encoded unicode strings http://www.python.org/news/security/PSF-2006-001/ Advisory ID: PSF-2006-001 Issue Date: October 12, 2006 Product: Python Versions: 2.2, 2.3, 2.4 prior to 2.4.4, wide unicode (UCS-4) builds only CVE Names: CAN-2006-4980
1
1374
by: Nico | last post by:
Where can I get it? I am a new comer here, I need your help.
0
1023
by: =?Utf-8?B?QWxmb250eg==?= | last post by:
Looking for some insight into an issue with a MS Word 2003 addin using class serialization to store data. When using firewall software with a ‘Buffer Overflow Exploit Prevention’ feature, Proventia Desktop the calls to XML serialize o deserialize are blocked. The application gives an error Buffer Overrun blocked on NtCreateFile. ...
0
7779
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7693
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
8021
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. ...
1
7781
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...
0
8064
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
6418
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...
0
5291
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...
1
2208
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
1301
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.