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 11-23-2011, 07:47 PM   PM User | #1
InJust
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
InJust is an unknown quantity at this point
Question DIV help

Im trying to create a website (obviously) but when I try to position one div next to another the background in one stops working I dont know why this isnt working or how to fix it. By the way I'm very new to html and css so my code is probably sloppy. Thank you in advance for any help you can give.

HTML
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productivity</title>
<link href="mainstyles.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'>
</head>

<body class="background webfonts" >

<div id="header" class="headerdiv" >
<span class="header"> My </span>
<span class="headeremph"> Productivity </span>
<span class="header"> Website </span>
</div>

<div id="conent_container" class="contentdiv">

<img src="assets/content_header.png"  />

<div id="content_main-container_bg" class="maincontentbg" >

<div id="content_text" class="contenttextdiv">

<div id="title_container" class="contentpagetitle"> Page Title goes here </div>

<span class="contenttitletext">Content Title Goes Here</span><br />

<span class="contenttext"> Content...content goes here (need bottom margin of ~5px)</span>

</div>
</div>

<div id="vert-nav-header_container"  class="vert-nav-header"><img src="assets/vert_nav_header.png"  /></div>

</div>
</body>
</html>
CSS
Code:
@charset "utf-8";
/* CSS Document */
.webfonts {
	font-family: 'Ubuntu Condensed', sans-serif;
}
.background {
	background-image:url(Pictures/background_texture.jpg);
	background-attachment:fixed;
	background-position:center;
}
.headerdiv {
	margin-top:30px;
	margin-left:30%;
}
.header {
	font-size:36px;
	color:#CCCCCC;
}
.headeremph {
	font-size:43px;
	color:#999999;
}
.contentdiv {
	margin-left:auto;
	margin-right:auto;
	margin-top:30px;
	width:631px;
}
.maincontentbg {
	background-image:url(assets/main_content_repeat.png);
	background-repeat:repeat-y;
	background-position:center;
}
.contenttitletext {
	color:#CCCCCC;
	font-size:24px;
}
.contenttext {
	color:#CCCCCC;
	font-size:16px;
	margin-left:15px;
	margin-bottom:15px;
}
.contenttextdiv {
	margin-left:5px;
}
.contentpagetitle {
	font-size:36px;
	color:#999999;
	margin-bottom:5px;
}
.vert-nav-header {
	margin-left:50px;
}
InJust is offline   Reply With Quote
Old 11-23-2011, 09:03 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello InJust,
Can you be a little more specific? Exactly what two elements are you trying to place beside each other?

Typically, you use floats to put things side by side. This usually means you have to clear your floats too, or the containing element doesn't behave the way you expect it to.

See this explanation of how overflow: auto; clears your floats.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
InJust (11-23-2011)
Old 11-23-2011, 09:36 PM   PM User | #3
InJust
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
InJust is an unknown quantity at this point
Here is a pic before I set the "contenttextdiv" to float:left


and here it is after I set the div to float:left

I'm going to read up on that link so if that fixes it just ingore me
InJust is offline   Reply With Quote
Old 11-23-2011, 10:29 PM   PM User | #4
InJust
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
InJust is an unknown quantity at this point
well, after an hour of fiddling I got it, thanks for the help Excavator.
InJust is offline   Reply With Quote
Reply

Bookmarks

Tags
beginner, div

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:19 AM.


Advertisement
Log in to turn off these ads.