Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets 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 May 6th, 2005, 12:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default Positioning Problem

Hello
i am tying to figure out CSS positioning and I am having alot of problems, I keep running into this problem.

My question is why will the input box will not remain inside the <div> tag?
http://www.eclecticpixel.com/problemchild

Code on the html page:

<div class="outerbox">
    <div class="DescriptBox">Descript 1</div>
    <div class="InputBox">
    <input type=text name="field1" value=bbbb size=12 maxlength=12>
    </div>
</div>

<div class="outerbox">
    <div class="DescriptBox">Descript 2</div>
    <div class="InputBox">
    <input type=text name="field2" value=aaa size=12 maxlength=12>
    </div>
</div>

CSS____

.outerbox {
    width: 500px;
    clear: right;
    margin-left: auto;
    margin-right: auto;
    border-color: #BDEAE1;
    border-width: 1px;
    border-style: solid;
}

.DescriptBox
{
    width: 200px;
    padding: .25em;
    margin: 0;
    border-color: #BDEAE1;
    border-width: 0 1px 0 0;
    border-style: solid;
    background-color: #F2FBF9;
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #04AF8D;
}

.InputBox
{
    padding: 2px;
    float: right;
    border: 1px solid black;
}

I have tried just aobut everything I can think up and I guess I just don't get it.

Thanks In Advance
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old May 6th, 2005, 07:58 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Why not just use tables?

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old May 6th, 2005, 08:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I could, but I am trying to learn CSS and start moving towards using this for my layouts. It seems like everything I read tells me that this is the future of the web because it is so versital.

Thanks
Mike
 
Old May 6th, 2005, 09:16 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

There's nothing wrong with using tables to layout a form. That's a relationship between information, and I would argue that is the best way to go.

See my responses to the "Are tables bad?" question:
http://p2p.wrox.com/topic.asp?TOPIC_ID=29544
http://p2p.wrox.com/topic.asp?TOPIC_ID=28512

What you are doing with divs is essentailly recreating what tables already provide. For an intellectual exercise there is nothing wrong with that, but for the real world there's no need to substitute all that with what tables can already do, well unless you just happen to like that approach!

First thing's first. You aren't writing valid XHTML.
 * All attributes must be quoted
 * All tag names and attributes must be lowercase.
 * Markup must be well-formed, all tags must have an opening and closing tag (or the "/>" shortcut to close a tag).

There is more (the XHTML MIME type, et all), but for now that is enough to get you started.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>gggg</title>
    <style type='text/css'>
        .outerbox {
            width: 500px;
            clear: left;
            margin: auto;     /* margin-left: auto; margin-right: auto; */       
            border: 1px solid #BDEAE1; /* border-width, border-style, border-color */
        }
        .DescriptBox
        {
            width: 200px;
            padding: .25em;
            margin: 0;
            border-right: 1px solid #BDEAE1; 
            background: #F2FBF9;
            font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif; /* font-size, font-family */
            color: #04AF8D;
            float: left; /* Ok, the element that you want to float must come first */
        }
        .InputBox
        {
            padding: 2px;
            /*float: right;*/
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <div id="maskhead">
        <div id="logoPlaceholder">
           <img src="images/logo.gif" width="262" height="74" border="0" />
        </div>
    </div>
    <div id="contentHolder">
        <div class="outerbox">
            <div class="DescriptBox">Descript 1</div>
            <div class="InputBox">
                <input type="text" name="field1" value="bbbb" size="12" maxlength="12" /> 
            </div>
        </div>
        <div class="outerbox">
            <div class="DescriptBox">Descript 2</div>
            <div class="InputBox">
                    <input type=text name="field2" value="aaa" size="12" maxlength="12" /> 
            </div> 
        </div>
        <div id="maskhead">
            <div>
                bottom
            </div>
        </div>
    </div> 
 </body>
</html>
HTH!





Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old May 6th, 2005, 09:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Rich this will help alot! Like I said I am just starting out with this and everything always seems to be a battle in the beginning.

Thanks For Your Time
Mike
 
Old May 27th, 2005, 08:03 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this;

http://www.htmlgoodies.com/beyond/cs...le.php/3470391






Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Positioning zach_1988 XSLT 4 December 1st, 2008 07:45 PM
Positioning Problem in Firefox and Netscape echovue Javascript 3 April 13th, 2007 08:39 AM
menu positioning problem isheikh HTML Code Clinic 27 June 5th, 2004 10:52 AM
menu positioning problem isheikh Wrox Book Feedback 1 May 30th, 2004 12:39 AM





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