473,498 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

offset positions using CSS when resize browser

I posted a question before regarding the offset positions when I used
CSS. Some people suggested I should use percentage instead of pixels?
I tried many different ways, but the position still offset when I
resize the browser. Here's the modified code. I just don't want the
link and frequently used link text are mixed when i resize the
browser. Any workarounds to this problem? Please help!!
<html>
<head>

<style type="text/css">
H2
{
FONT: bold 17px Georgia
}
H2.SECOND
{
COLOR: red;
position: absolute;
top: 10%;
left: 70%
}
P
{
FONT: bold 12px Georgia;
position: absolute;
top: 15%;
left: 70%
}
</style>

</head>

<body>

<H2 class="SECOND">Frequently Used Links</H2>

<P>
<a href="#">Link 1</a> |

<a href="#">Link 2</a> |

<a href="#">Link 3</a> |

<a href="#">Link 4</a> |

<a href="#">Link 5</a>
</P>
</body>
</html>
Jul 20 '05 #1
2 4438

"Matt" <jr********@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
| I posted a question before regarding the offset positions when
I used
| CSS. Some people suggested I should use percentage instead of
pixels?
| I tried many different ways, but the position still offset when
I
| resize the browser. Here's the modified code. I just don't want
the
| link and frequently used link text are mixed when i resize the
| browser. Any workarounds to this problem? Please help!!
|
|
| <html>
| <head>
|
| <style type="text/css">
| H2
| {
| FONT: bold 17px Georgia
| }
| H2.SECOND
| {
| COLOR: red;
| position: absolute;
| top: 10%;
| left: 70%
| }
| P
| {
| FONT: bold 12px Georgia;
| position: absolute;
| top: 15%;
| left: 70%
| }
| </style>
|
| </head>
|
| <body>
|
| <H2 class="SECOND">Frequently Used Links</H2>
|
| <P>
| <a href="#">Link 1</a> |
|
| <a href="#">Link 2</a> |
|
| <a href="#">Link 3</a> |
|
| <a href="#">Link 4</a> |
|
| <a href="#">Link 5</a>
| </P>
| </body>
| </html>

Matt,

When I viewed your markup above at 800x600 the links wrapped, at
640x480 the text and links really bunched up. Take a look here

http://webpages.charter.net/rwtest/s...tt_640x480.gif
http://webpages.charter.net/rwtest/s...tt_800x600.gif
(sorry if the links wrapped)

I'm not sure what you have in mind for the rest of the page but I
marked up a small sample here with some filler text. I placed the
Frequently Used Links text and the links in a small div floated
to the right within another div. I'm not sure about the top
margin you wanted, I decreased it to 10% but it's still a ways
down. Take a look here

http://webpages.charter.net/rwtest/stuff/matt.htm

hth
--
Chet
ng******@NOcharterSPAM.net (remove NO.....SPAM)
Jul 20 '05 #2
On 12 Feb 2004 17:10:03 -0800, Matt <jr********@hotmail.com> wrote:
I posted a question before regarding the offset positions when I used
CSS. Some people suggested I should use percentage instead of pixels?
I tried many different ways, but the position still offset when I
resize the browser. Here's the modified code. I just don't want the
link and frequently used link text are mixed when i resize the
browser. Any workarounds to this problem? Please help!!


Your problem is that you're expecting sizes to scale when they don't. With
the title at 10% down and the links at 15%, if the title is more than 5%
of the height of the viewport of COURSE you're going to get them to cross.

If you want to keep them from crossing, absolute positioning is NOT your
tool here.

One common way to solve this problem is to take all the elements which
need to be arranged respective of themselves and put them in a div.

<div id="linkbox">
<!-- If you want to use this more than once on a page, use class instead
of id. -->
<p>blah blah here's yer text</p>
<p>another line of text that goes with the above</p>
<p>ok, one more</p>
</div>

Now style the id (if you use a class, use .linkbox instead.)

#linkbox {
move this where you want it
}

Whatever you do with this div, the contents will remain associated with
each other.

That said, I'd do something like this instead...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">

h2 {
font: bold 1.2em Georgia, serif;
}

/* note font size is in ems */

#linkbox {
position: absolute;
top: 10%;
right: 1em;
}

/* positioned to the right, where you wanted it, 1 em away from right
margin */

h2.second {
color: red;
}

/* And finally I make the links a list, it looks nicer in a no-css page,
check this out... */

ul {
padding: 0;
margin: 0;
}

li {
margin: 0;
font: bold 1em Georgia, serif;
display: inline;
border-left: 1px black solid;
padding-left: 0.2em;
}

#first {
border: 0;
padding: 0;
}

</style>

</head>

<body>
<div id="linkbox">
<h2 class="second">Frequently Used Links</h2>

<ul>
<li id="first"><a href="#">Link 1</a></li>

<li><a href="#">Link 2</a></li>

<li><a href="#">Link 3</a></li>

<li><a href="#">Link 4</a></li>

<li><a href="#">Link 5</a></li>
</ul>

</div>

</body>
</html>
Jul 20 '05 #3

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

Similar topics

2
12766
by: Put 030516 in email subj to get thru | last post by:
I've always been bothered about having to statically declare the size of a Java applet window (container?) in the calling HTML. I've always wanted the moral equivalent of width=50% statement (of...
2
2648
by: Matt | last post by:
I use CSS for positionings in my html page, the problem is when i resize the browser, the positions are offset. Here's the code, any ideas?? <html> <head> <style type="text/css">
0
11335
by: Matt | last post by:
I am new to CSS. My task is to add a table and frequently used link on the right hand side. Here's the html code and css, I really appreciate if u can copy and paste and take a look. It looks fine...
3
60990
by: Sean | last post by:
Have you ever wanted to add the great features inherent in Google Maps? Here is how you do it. ============== == STEP ONE == ============== Create a new MS Access form called frmGoogleMap....
3
1466
by: Mark | last post by:
Hello all - I'm creating an application that uses a datagridview control. My development environment is an HP Laptop with a NVIDIA Geforce 4 440 Go 64M. While using this object, a queer...
7
5792
by: Bill H | last post by:
When I do website design I have my screen (on a PC) set for 1600 x 1200 or greater resolution so that I can have as many windows open as I need and not have to flip between them. The issue I have...
2
3666
by: =?Utf-8?B?Sm9ubnk=?= | last post by:
I have an ASP.NET 2.0 C# web application that is contacting an Exchange server using WEBDAV. It allows the users to look up appointments for a future date. The problem I have is determining the...
12
3991
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in...
8
3975
by: Thomas Mlynarczyk | last post by:
Hello, I want to split a given string into tokens which are defined by regexes: // example tokens - a bit more complex in real $tokens = array( 'NUMBER' ='~^\d+~', 'NAME' ='~^+~', 'ANY' ...
0
7121
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
7197
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
7375
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
5456
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,...
0
3088
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
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 ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
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.