Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to layout a page - beginners

Status
Not open for further replies.

PGO01

Programmer
Jan 8, 2008
156
GB
I'm new to asp .net programming and I am having difficulty with the layout of my pages.

I want a simple input data page with things like Name/DOB/Gender/Hobbies/Etc. What's the best way to lay this out on the page? Using floating divs or a table or both or a different way?

I tried a simple 2 column table but couldn't get the columns width to work correctly, here's what I had:

Stylesheet
Code:
.DataInputTable
{
    width: 100%;
}

.DataInputTable td:first-child
{
    width: 20%;
}

HTML
Code:
<div>
    <table class="DataInputTable">
        <tr>
            <td>a</td>
            <td>b</td>
        </tr>
        <tr>
            <td>c</td>
            <td>d</td>
        </tr>
    </table>
</div>

Both columns end up the same width... what am I doing wrong?

PS. I am using Firefox.
 
Looks right to me. Put a border="2" on the table and you will see that the first td is 20% and the second is 80% together they equal the tables 100%.

How you layout your page is upto you, everyone has there own way and or their opinions of the proper way.

If I had to create a web app or web site from scratch I would use .NET's themes and CSS to position everything.
This way you can have multiple themes to give your site differnt looks, colors ect...

Ordinary Programmer
 
I'm no guru with CSS but your td class defnintion is incorrect. The ":first-child" does nothing, so each td element is 20%
 
i believe too, you need to navigate through the tr tag
Code:
.DataInputTable tr td:first-child
that said, this is purely an html/css issue. i would ask the gurus in forum215.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Thanks all.

I've decided to look at the dynamic data and dynamic data entities in .Net 3.5.

Regarding the CSS issue, the border="2" didn't seem to do anything, tried border="1" also. Weird.

Tried tr td:first-child but still nothing. Very strange I think I will take your advice and check out the other forum.

Regards,
Pete

PS. Jason I tried out your database management implementation in your sig. and I have to admit it's pretty damn good! If I weren't going down the dynamic route I would definitely use it.

 
thanks Pete. I rarely work with raw ado.net anymore. it's all ORM frameworks now. 99% of the time it's NHibernate. the other 1% of the time is LLBL.

i got the idea for the connection management from NHibernate where session per view is the preferred model for data access for the web.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top