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 08-14-2012, 07:54 PM   PM User | #1
txbred
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 3
Thanked 0 Times in 0 Posts
txbred is an unknown quantity at this point
Question Can columns be formatted within a column & Menu placement

Can I create two columns within a column or am I going about this the wrong way? I want the logo on the left and the schedule on the right as pictured; however I want the Sunday Services and the Wednesday Services to be placed side by side with a veritical line between them. Should I be creating 3 columns instead?

Also, I have included my navigation menu within the header and I want the bottom of the menu boxes to sit on top of the bottom of the header. You can see I left out a bottom border on the menu boxes so that the white space between the header and main content creates the bottom border. I tried the clearfix code, but it is not working. Not sure if my other code is preventing that or if I'm going about this wrong as well as my first issue. I have attached an image of my header to go along with my code.

Your help is appreciated! This is my last resort as I have been trying different methods for two day, lol!

HTML CODE:
Code:
<!--START HEADER-->
			<div id="header">
				<div class="headerColumns">
					<!--LEFT COLUMN-->					
					<div class="leftHeaderColumn">				
						<div id="logo">
						<a href="index.html"><img src="images/cbccrosslogo.gif" alt="Covenant Church A Baptist Family" width="500" height="167" id="cbclogo" /></a>
						</div>			
					</div>
					
					<!--LEFT COLUMN-->
					<div class="rightHeaderColumn">	
						<div class="scheduleColumns">
							<div class="headSchedule" class="sundayColumn">
							<h2>Sunday Services</h2>
							<p>9:00am<br />
							Rev. Ralph Willis</p>
							<p>10:00am<br />
							Dr. Billy Storms<br />
							Children & Youth Classes
							</p>
							<p>11:00am<br />
							Dr. Billy Storms<br />
							</p>
							</div>
							
							<div class="headSchedule" class="wednesdayColumn">
							<h2>Wednesday Services</h2>
							<p>7:00pm<br />
							Dr. Billy Storms<br />
							Children & Youth Night
							</p>
							<p>10:00am<br />
							Taize Prayer Service<br />
							Rev. Ralph Willis<br />
							<span class="italic">(Every Fourth Wednesday)</span>
							</p>
							</div>
						</div>
					</div>
				</div>
						
					<!--START MAIN NAVIGATION-->
					<div class="menu" class="clearfix">
						<ul id="mainNav">
						<li><a href="index.html">HOME</a></li>
						<li><a href="worship.html">WORSHIP</a></li>
						<li><a href="pastors.html">OUR PASTORS</a></li>
						<li><a href="about.html">ABOUT</a></li>					
						<li><a href="ministries.html">MINISTRIES</a></li>
						<li><a href="events.html">EVENTS</a></li>
						<li><a href="media.html">MEDIA</a></li>
						<li><a href="staff.html">STAFF</a></li>
						<li><a href="contact.html">CONTACT</a></li>
						</ul>
					</div>
					<!--END MAIN NAVIGATION-->
			</div>
			<!--END HEADER-->

CSS CODE:
Code:
h2 {
	font-size: 1.3em;
	color: white;
}

/*HEADER*/
#header {
	clear: both;
	float: left;
	width: 100%;
	height: 345px;
	border-bottom: 2px solid #fff;
	background: #2C465D;
}

.headerColumns {
	clear: both;
	width: 100%;
}

.headerColumns, .leftHeaderColumn {
	float: left;	
}

.headerColumns, .rightHeaderColumn {
	float: right;	
}

.headSchedule {
	color: white;
	font-size: 0.75em;
	text-align: right;
}

#logo {
	display: block;
	text-align: left;
	color: white;
	padding-left: 30px;
}

#cbclogo {
	border: 0;
}

.scheduleColumns{
	clear: both;
	width: 100%;
}

.scheduleColumns, .sundayColumn {
	float: left;
}

.scheduleColumns,.wednesdayColumn {
	float: right;
}

.italic {
	font-style: italic;
	font-size: 0.8em;
}

/*MENU--CENTERED*/
.menu {
	clear: both;
	float: left;
	width: 100%;
	overflow: hidden;
	position: relative;
}

.menu ul {
	clear: left;
	float: left;
	position: relative;
	left: 50%;
	text-align: center;
	margin: 0;
	
}

.menu ul li {
	display: block;
	float: left;
	position: relative;
	right: 50%;
	margin: 0;
	padding: 0;
}

.menu ul li a {
	display: block;
	margin: 0 0 0 3px;
	padding: 3px 10px;
}

/*NAVIGATION*/
#mainNav ul {
	text-align: center;
	margin-top: 0;
	width: 144px;
}

#mainNav li {
	display: inline;
}

#mainNav a{
	padding: 20px;
	color: white;
	text-decoration: none;
	text-align: center;
	background-color: #AFAEE7;
	border-width: 2px;
	border-style: solid;
	border-bottom: none;
	border-top-color: #fff;
	border-right-color: #fff;
	border-left-color: #fff;
}
Attached Thumbnails
Click image for larger version

Name:	header.jpg
Views:	33
Size:	29.5 KB
ID:	11456  
txbred is offline   Reply With Quote
Old 08-14-2012, 10:30 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Code:
<div class="headSchedule" class="sundayColumn">
You cannot assign two classes in this way. Change to this:

Code:
<div class="headSchedule sundayColumn">
This occurs it three separate places of your code. Without this change the first class assignment is dropped, and so the corresponding css rules are ignored.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
txbred (08-15-2012)
Old 08-14-2012, 11:23 PM   PM User | #3
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
I'm not a fan of divitis; that is, unnecessary over-use of DIVs.

You also floated your headerColumns left, then right - only right will be remembered. But I don't think you need this div at all. You don't need to float #header - it is a div and will naturally expand across the available width of the screen. I don't believe your menu needs to float either.

I think you're over-using float and clear. The attached screenshot gives an indication of what happens when the screen width is reduced.

Floated element should generally be given a width. Or their parent-container should be given a width and/or a min-width, to prevent the dropping shown in the screenshot. (This does not apply to images as they already have a width.)

Don't forget to make good use of margins and padding. For example, apply these to the two schedules to separate them and push them further into the window (if required).

I've had a play with simplifying here:

Code:
<!DOCTYPE html>
<html>
<head>
<meta name="keywords" content="key, words">
<meta name="description" content="description">
<title>Some Title</title>
<style type="text/css">
html, body {
    width: 100%;
    margin: 0;
    padding: 0;
}
h2 {
	font-size: 1.3em;
	color: white;
}

/*HEADER*/
#header {
	width: 100%;
    margin: 0;
    padding: 0;
	height: 345px;
	border-bottom: 2px solid #fff;
	background: #2C465D;
}

#logo {
    float: left;
	margin-left: 30px;
}

#cbclogo {
	border: 0;
}

.headSchedule {
	color: white;
	font-size: 0.75em;
	text-align: right;
}
.sundayColumn, .wednesdayColumn {
    float: right;
}

.italic {
	font-style: italic;
	font-size: 0.8em;
}

/*MENU--CENTERED*/
.menu {
	clear: both;
	width: 100%;
	overflow: hidden;
	position: relative;
}

.menu ul {
	clear: left;
	float: left;
	position: relative;
	left: 50%;
	text-align: center;
	margin: 0;
	
}

.menu ul li {
	display: block;
	float: left;
	position: relative;
	right: 50%;
	margin: 0;
	padding: 0;
}

.menu ul li a {
	display: block;
	margin: 0 0 0 3px;
	padding: 3px 10px;
}

/*NAVIGATION*/
#mainNav ul {
	text-align: center;
	margin-top: 0;
	width: 144px;
}

#mainNav li {
	display: inline;
}

#mainNav a{
	padding: 20px;
	color: white;
	text-decoration: none;
	text-align: center;
	background-color: #AFAEE7;
	border-width: 2px;
	border-style: solid;
	border-bottom: none;
	border-top-color: #fff;
	border-right-color: #fff;
	border-left-color: #fff;
}
</style>



</head>
<body>
<!--START HEADER-->
			<div id="header">
                <!--LEFT COLUMN-->								
                <div id="logo">
                <a href="index.html">
                    <img src="images/cbccrosslogo.gif" alt="Covenant Church A Baptist Family" width="500" height="167" id="cbclogo" />
                </a>
                </div>
                
                <!--LEFT COLUMN-->	
                <div class="headSchedule sundayColumn">

                    <h2>Sunday Services</h2>
                    <p>9:00am<br />
                    Rev. Ralph Willis</p>
                    <p>10:00am<br />
                    Dr. Billy Storms<br />
                    Children & Youth Classes
                    </p>
                    <p>11:00am<br />
                    Dr. Billy Storms<br />
                    </p>
                </div>
                    
                <div class="headSchedule wednesdayColumn">
                    <h2>Wednesday Services</h2>
                    <p>7:00pm<br />
                    Dr. Billy Storms<br />
                    Children & Youth Night
                    </p>
                    <p>10:00am<br />
                    Taize Prayer Service<br />
                    Rev. Ralph Willis<br />
                    <span class="italic">(Every Fourth Wednesday)</span>
                    </p>
                </div>

						
                <!--START MAIN NAVIGATION-->
                <div class="menu clearfix">
                    <ul id="mainNav">
                    <li><a href="index.html">HOME</a></li>
                    <li><a href="worship.html">WORSHIP</a></li>
                    <li><a href="pastors.html">OUR PASTORS</a></li>
                    <li><a href="about.html">ABOUT</a></li>					
                    <li><a href="ministries.html">MINISTRIES</a></li>
                    <li><a href="events.html">EVENTS</a></li>
                    <li><a href="media.html">MEDIA</a></li>
                    <li><a href="staff.html">STAFF</a></li>
                    <li><a href="contact.html">CONTACT</a></li>
                    </ul>
                </div>
                <!--END MAIN NAVIGATION-->
			</div>
			<!--END HEADER-->

</body>
</html>
I hope that you don't see this as a criticism. I'm just trying to offer a few pointers
Attached Thumbnails
Click image for larger version

Name:	church1.png
Views:	13
Size:	48.6 KB
ID:	11457  
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
txbred (08-15-2012)
Old 08-15-2012, 01:01 PM   PM User | #4
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
.. If you want a vertical line between the two schedules then you could either:

apply a border-right to the left-most schedule, and/or a border-left to the other one;
apply a background image to one of the schedules, positioning it to the right (or left) side. Give the schedule some padding so that the line doesn't sit behind the text of the schedule.

A third possibility, but one that is not generally recommended, is to add an image and float it to the right so that it sits between the two schedules.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 08-15-2012, 09:42 PM   PM User | #5
txbred
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 3
Thanked 0 Times in 0 Posts
txbred is an unknown quantity at this point
Thank you for all your help! You don't how much I appreciate it!

I took all your considerations and made most of the revisions. I'm so glad I decided to post the question, otherwise those classes would have given me a lot of trouble since I was not assigning multiple classes correctly.

My only question left at this point is how to decide/assign the correct percentages to the floated elements. The current elements with percentages came from tutorials and learning a little bit about them. I searched for all my floated elements and will study my html/css and play with it a bit to see what happens.

Here is an image of my changes and as you can see everything worked. Fixing the classes made the biggest difference of all. Agaen, thanks for the help!
Attached Thumbnails
Click image for larger version

Name:	header2.jpg
Views:	16
Size:	53.9 KB
ID:	11459  
txbred is offline   Reply With Quote
Old 08-15-2012, 09:52 PM   PM User | #6
txbred
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 3
Thanked 0 Times in 0 Posts
txbred is an unknown quantity at this point
I forgot one more question! In the attached image you can see that the Right Column Content shifted to the right so the right edge of the blue box butts up against the edge of the viewing area. I actually like this better than the way the Left Column Content is set up, but I don't know the best way to go about achieving this for the left side b/c I don't know what change I made for the right side to move. If I play with the percentage values I can move it more to the left, but again I'm not sure if this is the best procedure to fix it. I did not change any percentage values for the right content so I know there should be a better option.

Code:
/*BEGIN 3 COLUMN LIQUID LAYOUT*/
.container {
	position:relative;	/* This fixes the IE7 overflow hidden bug */
	clear:both;
	float:left;
	width:100%;			/* width of whole page */
	overflow:hidden;	/* This chops off any overhanging divs */
}

.colmid,
.colleft {
	float: left;
	width:100%;
	position:relative;
}

.colmid {
	right: 25%;
	/*background: #AFAEE7; ADD CODE BACK TO DELETE WHITE SPACE*/
}

.colleft {
	right: 50%;
	/*background: #032747; ADD CODE BACK TO DELETE WHITE SPACE*/
}

/*col1, col2, and col3*/
.mainContent,
.leftColumn, 
.rightColumn {
	float:left;
	width: ;
	position:relative;
	padding:0 0 1em 0;
	overflow:hidden;
}

/*MAIN CONTENT*/
.mainContent {
	width: 46%;
	left: 102%;
	background-color: #AFAEE7;
}

/*LEFT CONTENT*/
.leftColumn {
	width: 21%;
	left: 31%;
	color: white;
	background-color: #032747;
	text-align: left;
}

.boxes {
	text-align: left;
	padding-left: 15px;
}

/*RIGHT CONTENT*/
.rightColumn {
	width: 21%;
	left: 85%;
	padding-right: 15px;
	color: white;
	background-color: #032747;
	text-align: right;
}
/*END 3 COLUMN LIQUID LAYOUT*/

Code:
<div class="container">
			<div class="colmid">		
				<div class="colleft">		
					<!--COLUMN 1 START-->
					<!--START MAIN CONTENT-->
					<div class="mainContent">
						<h1>WELCOME</h1>
						<p>Our task is to use God's gift...do in Matthew 28:18-20.</p>
					<!--END MAIN CONTENT-->
					</div>						
						
					<!--COLUMN 2 START-->
					<div class="leftColumn boxes">						
						<h1>LEFT COLUMN CONTENT</h1>
						
						<p id="youthGroupBox">text and image goes here</p>
						
						<p id="supportGroupBox">text and image goes here</p>
						
						<p id="calendarBox">text and image goes here</p>
						
						<p id="prayerRequestBox">text and image goes here</p>
						
						<p id="faqBox" >text and image goes here</p>
						
						<p id="photoAlbumBox">text and image goes here</p>						
					</div>
					<!--END COLUMN 2-->
						
					<!--COLUMN 3 START-->
					<div class="rightColumn">
						<h1>RIGHT COLUMN CONTENT</h1>
						<p>text and image goes here</p>
					</div>
					<!--END COLUMN 3-->
				</div>
			</div>
		</div>

Last edited by txbred; 08-15-2012 at 09:58 PM.. Reason: adding html/css code
txbred is offline   Reply With Quote
Old 08-15-2012, 10:51 PM   PM User | #7
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
I never looked beyond the top region. Gosh, where did all those percentages come from?! There seems to be a large region of your page that disappears way outside the browser window

Normally a simple margin: 0 would work. But with all those percentages, left, right, etc.. It's looking tricky to fix. All you can do for the moment is adjust left: 31% for leftColumn, but it is unlikely to align properly to the edge of the viewport.

Looks like you are after a liquid (aka.fluid) 3-column layout - using percentages is a strong indication that you want the page to expand and contract with the browser-width. I would read something like this.

Even though you might be looking for a liquid layout, you can still add min-width and max-width (pixel) values to the main container elements, to prevent total collapse and, what I've just decided to call, the dead-fish effect . That is, with a very hi-res monitor, all the content bobbing at the top of the screen
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 08-15-2012, 11:33 PM   PM User | #8
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Something like this perhaps (just a suggestion!) - I ignored the header:

Code:
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
html, body {
    margin: 0; padding: 0;
}
        /*BEGIN 3 COLUMN LIQUID LAYOUT*/
.container {
	position:relative;	/* This fixes the IE7 overflow hidden bug */
	clear:both;
	width:100%;			/* width of whole page */
	overflow:auto;	/* This chops off any overhanging divs */
    padding: 0; margin: 0;
    background-color: #AFAEE7;
}

/*MAIN CONTENT*/
.mainContent {
    float: left;
	width: 55%;
    padding: 5px 0 5px 10px;
}

/*LEFT CONTENT*/
.leftColumn {
    float: left;
	width: 21%;
	color: white;
	background-color: #032747;
}

/*RIGHT CONTENT*/
.rightColumn {
    float: right;
	width: 21%;
	padding-right: 15px;
	color: white;
	background-color: #032747;
	text-align: right;
}
/*END 3 COLUMN LIQUID LAYOUT*/
        
</style>

</head>
<body>
<div class="container">		
    						
            
    <!--COLUMN 2 START-->
    <div class="leftColumn">						
        <h1>LEFT COLUMN CONTENT</h1>
        
        <p id="youthGroupBox">text and image goes here</p>
        
        <p id="supportGroupBox">text and image goes here</p>
        
        <p id="calendarBox">text and image goes here</p>
        
        <p id="prayerRequestBox">text and image goes here</p>
        
        <p id="faqBox" >text and image goes here</p>
        
        <p id="photoAlbumBox">text and image goes here</p>						
    </div>

     <!--START MAIN CONTENT-->
    <div class="mainContent">
        <h1>WELCOME</h1>
        <p>Our task is to use God's gift...do in Matthew 28:18-20.</p>
    <!--END MAIN CONTENT-->
    </div>
    
    <!--COLUMN 3 START-->
    <div class="rightColumn">
        <h1>RIGHT COLUMN CONTENT</h1>
        <p>text and image goes here</p>
    </div>
</div>

</body>
</html>
And play with min- and max- width (in pixels) for the three regions so that they don't collapse or drop underneath each other.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
txbred (08-16-2012)
Old 08-16-2012, 02:25 AM   PM User | #9
txbred
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 3
Thanked 0 Times in 0 Posts
txbred is an unknown quantity at this point
Yes, I am trying to create a fluid/liquid 3-column layout. Thanks for the link! I'll read through it. After skimming it, it looks like I will be able to follow the guidelines in the articles.

I'm also reading the book CSS the missing manual. I'm really trying to get this stuff down b/c I'm in school for web design. This is not just a hobby, but something I want to do for a living. It's been over a year since my first web design class and I haven't worked on a website since then so I have forgotten a lot.
txbred is offline   Reply With Quote
Old 08-16-2012, 07:15 AM   PM User | #10
sanjuanabrown
New to the CF scene

 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sanjuanabrown is an unknown quantity at this point
The folder menu jumps away before I can Identify it for placement of material from inbox.
get redirected here
sanjuanabrown is offline   Reply With Quote
Reply

Bookmarks

Tags
columns, divs, header, menu, navigation

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 07:50 AM.


Advertisement
Log in to turn off these ads.