Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-16-2013, 03:23 AM   PM User | #1
rjpeek25
New to the CF scene

 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rjpeek25 is an unknown quantity at this point
Tab Navigation Layout

I want to create a dynamic tab navigation menu using javascript. I want the tabs/content area to be outlined with a border (1px). I want the content area to expand to the bottom of the browser's viewport (minus a margin) when there is little content then beyond when the content grows past the viewport. I was thinking I could use an unordered list for the tabs and a division for the content area. The problem that I'm having is when I set the division height to 100%, it goes below the viewport. If I use a table (nested table) I can get the desired effect but run into other problems. Can the content area be done with HTML and css or do I need javascript to control the content area height? What are your suggestion.
rjpeek25 is offline   Reply With Quote
Old 01-16-2013, 01:45 PM   PM User | #2
L0adOpt1c
New Coder

 
L0adOpt1c's Avatar
 
Join Date: Jan 2013
Location: <bed />
Posts: 87
Thanks: 0
Thanked 6 Times in 6 Posts
L0adOpt1c is an unknown quantity at this point
Height should be easily manageable with HTML and CSS.
By the way, never EVER use tables for layout. They are awful.
Can I see your code?
And have you validated?
L0adOpt1c is offline   Reply With Quote
Old 01-17-2013, 01:35 AM   PM User | #3
rjpeek25
New to the CF scene

 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rjpeek25 is an unknown quantity at this point
<html>

<head>
<link rel=StyleSheet href='csspositioning1.css' type=text/css>
</head>

<body>

<ul>
<li class=thirdTab>Tab 3</li>
<li class=secondTab>Tab 2</li>
<li class=firstTab>Tab 1</li>
</ul>

<div class=contentArea>Content Area</div>

</body>
</html>

li {
width: 100px;
float: right;
border-left: 1px solid black;
border-top: 1px solid black;
list-style:none;
text-align: center;
color: blue;
font-weight: bold;
}

.firstTab {
background-color: #F0E68C;

}

.secondTab {
background-color: #98FB98;
border-bottom: 1px solid black;
}

.thirdTab {
border-right: 1px solid black;
border-bottom: 1px solid black;
background-color: #D3D3D3;
}

.contentArea {
position: relative;
bottom: 2px;
height: 100%;
clear: right;
border: 1px solid black;
background-color: #F0E68C;
z-index:-1;
}
rjpeek25 is offline   Reply With Quote
Old 01-17-2013, 01:36 AM   PM User | #4
rjpeek25
New to the CF scene

 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rjpeek25 is an unknown quantity at this point
I'm not validated, what is that?
rjpeek25 is offline   Reply With Quote
Old 01-17-2013, 01:00 PM   PM User | #5
L0adOpt1c
New Coder

 
L0adOpt1c's Avatar
 
Join Date: Jan 2013
Location: <bed />
Posts: 87
Thanks: 0
Thanked 6 Times in 6 Posts
L0adOpt1c is an unknown quantity at this point
A validator is a program that checks that your code is compliant to current industry standards.

http://validator.w3.org/

No download required.

This can catch annoying problems that are fairly simple pretty much instantly.
__________________
Validate, early and often. | Use W3Schools! |
Search for your answer before posting.
For the love of everything electronic, VALIDATE
Zdravstyvutye. Zdarova Chuvok?
L0adOpt1c is offline   Reply With Quote
Old 01-17-2013, 03:07 PM   PM User | #6
L0adOpt1c
New Coder

 
L0adOpt1c's Avatar
 
Join Date: Jan 2013
Location: <bed />
Posts: 87
Thanks: 0
Thanked 6 Times in 6 Posts
L0adOpt1c is an unknown quantity at this point
HTML: I've noticed you have no quotes around your values, and that could cause issues. Also, you should use a !DOCTYPE tag. These in themselves could fix whatever issues you are having. Remember to validate early and often!

CSS: It validated, so it's industry compliant, which means no novice errors. Just make sure that your values match what you want.

Hope this helped.
__________________
Validate, early and often. | Use W3Schools! |
Search for your answer before posting.
For the love of everything electronic, VALIDATE
Zdravstyvutye. Zdarova Chuvok?
L0adOpt1c is offline   Reply With Quote
Old 01-18-2013, 03:03 AM   PM User | #7
rjpeek25
New to the CF scene

 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rjpeek25 is an unknown quantity at this point
Now my code validates with only 2 warnings with the HTML but my Content Area (div) still goes below the view-port. I have also tried it with a container div and still get the same results.

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

<head>
<title>CSS Position 1</title>
<script type="text/javascript" src="csspositioning1.js"></script>
<link rel="StyleSheet" href="csspositioning1.css" type="text/css">
</head>

<body>

<ul>
<li class="thirdTab">Tab 3</li>
<li class="secondTab">Tab 2</li>
<li class="firstTab">Tab 1</li>
</ul>

<div class="contentArea">Content Area</div>

</body>
</html>


html, body {
height: 100%;
}

li {
width: 100px;
float: right;
border-left: 1px solid black;
border-top: 1px solid black;
list-style:none;
text-align: center;
color: blue;
font-weight: bold;
}

.firstTab {
background-color: #F0E68C;

}

.secondTab {
background-color: #98FB98;
border-bottom: 1px solid black;
}

.thirdTab {
border-right: 1px solid black;
border-bottom: 1px solid black;
background-color: #D3D3D3;
}

.contentArea {
position: relative;
bottom: 2px;
height: 100%;
clear: right;
border: 1px solid black;
background-color: #F0E68C;
z-index:-1;
}
rjpeek25 is offline   Reply With Quote
Old 01-18-2013, 06:31 AM   PM User | #8
webdevs
New Coder

 
Join Date: Nov 2012
Location: India
Posts: 52
Thanks: 0
Thanked 3 Times in 3 Posts
webdevs is an unknown quantity at this point
You can create CSS class and give the border using javascript based navigation menu.
webdevs is offline   Reply With Quote
Old 01-19-2013, 10:29 PM   PM User | #9
rjpeek25
New to the CF scene

 
Join Date: Jan 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
rjpeek25 is an unknown quantity at this point
I'm not sure what you mean, do you mean instead of giving the Content Area div a static CSS value (example: 100% or 600px) to control the size (height) of the Content Area, use javascript to control the size (height).
rjpeek25 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:30 PM.


Advertisement
Log in to turn off these ads.