Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2004, 11:45 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default Imar - Please look at this

This is about as simple as I can make it. If you look at this with 800x600 it looks perfect. If you switch to 1024x768 it's not right. I enclosed this in the script you gave me but I'm still not getting it right. Maybe I'm not coding the <applet> correctly. Anyway, getting close..need your help, please.

[code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>Test Full Width</title>
    <style type="text/css">
    #MenuWrapper
    {
        float: left;
        width: 150px;
    }

    #Menu
    {
        padding: 40px 0 50px 10px;
        list-style: none;
        margin: 0;
        line-height: 22px;

    }

    #Menu ul
    {
        padding: 0 0 0 14px;
        list-style: none;
        margin: 0;
    }

    #Menu li a
    {
        margin: 0;
        padding: 0 4px 0 0;
        padding-left: 14px;
    }

    #MainContent
    {
        padding: 40px 10px 0 0;
        margin: 0 0 0 0;
    }
    </style>
</head>
<body>

<div id="MenuWrapper">
    <ul id="Menu">
        <li><a href="http://www.networkdriven.com/" id="default">vvvvvvitem 1</a></li>
        <li><a href="#" id="default">vvvvvitem 2</a></li>
        <li><a href="#" id="default">vvvvitem 3</a></li>
    </ul>

</div>
<div id="MainContent">
    <div id="ContentArea">

<img src="../hard-disk7.jpg" width="400" height="310">

    </div>
</div>
</body>
</html>
[/code]

Rudy
__________________
Rudy
 
Old July 8th, 2004, 04:27 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rudy,

First of all, your doctype doesn't look good. It should look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

When I run the page, I see nothing but the menu because I don't have the .zip file for the Java Applet. What is the applet supposed to do? Do you really need applets? If I were you, I'd consider dropping the applet and use plain XHTML, CSS and JavaScript.
Also, the applet has a fixed width so it won't resize.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 8th, 2004, 11:36 AM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 
Quote:
quote:[First of all, your doctype doesn't look good. It should look like this:
Quote:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


I changed this in my original post code.

 
Quote:
quote:When I run the page, I see nothing but the menu because I don't have the .zip file for the Java Applet. What is the applet supposed to do? Do you really need applets? If I were you, I'd consider dropping the applet and use plain XHTML, CSS and JavaScript.
Quote:
Also, the applet has a fixed width so it won't resize.
I removed the applet and inserted an image. You will not see the image but should see it's outline. What I am wanting to do here is end up with the image centered on the page, between the menu on the left and the right margin of the screen. Then changed to different screen resolutions and it should look positioned correctly at whatever resolution I set my screen to.

If you cut and paste my post with the code, I have made the changes that I mentioned above.

Rudy
 
Old July 8th, 2004, 11:55 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Add the following CSS selector to your <style> tag:

#ContentArea
{
  text-align:center;
}

Chis will center the contents of the <div> with an id of ContentArea.
No matter how large you make your screen size, the image will be centered between the menu and the right edge of the browser.

Is this what you're after?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 8th, 2004, 12:28 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Yes, Yes!

Imar, that did the trick. Checked with several different resolution settings and it looks great in every one.

Thanks for all your help :)

Rudy




Similar Threads
Thread Thread Starter Forum Replies Last Post
Question for Imar aspcoder BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 22 April 28th, 2008 02:40 PM
Imar! help me shankhan Dreamweaver (all versions) 1 March 20th, 2005 05:45 PM
To Imar: Re: Sub Main shadowpug VB.NET 2002/2003 Basics 1 July 26th, 2003 02:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.