Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 4
There are 1 users currently browsing forums.
HTML/CSS Coding The basis of the World Wide Web, HTML, XHTML, and CSS make our forum possible, so it must be important right? Ask questions and receive help with these markups here.

Reply
  #1  
Old 01-21-2010
Child
 
Join Date: Oct 2008
Location: Israel
Age: 28
Posts: 84
Rep Power: 2
Dimkin is on a distinguished road
Question XHTML transitional question

Hello,
I have the following code:

HTML file
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><title>
	Revadim Project
</title>
<link href="Style.css" rel="stylesheet" type="text/css" /></head>
<body>

    <div id="container">
        <div id="content">
               <p>Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
				</p>
        </div>
        <div id="leftmenu">
                <p>Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
					Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
				</p>
        </div>
    </div>
</body>
</html>
CSS file
Code:
#container
{
	width:990px;
	border:2px solid black;
	margin:0 auto;
}

#content
{

	width:830px;
	float:right;
	border:1px solid black;
}

#leftmenu
{
	width:150px;
	float:left;
	border:1px solid black;
When I run the html file, everyhting runs fine except that the content and the leftmenu div aren't sitting insite the container div. From what I've checked this is happening because os me using the XHTML transitional. Can anyone tell me why this is happening and how to fix this?

Thank you in advance,
Dima
Reply With Quote
  #2  
Old 03-10-2010
Looking#'s Avatar
Toddler
 
Join Date: Mar 2010
Location: Maryland
Posts: 24
Rep Power: 0
Looking# is on a distinguished road
Re: XHTML transitional question

It looks to me that one of your problems is that you forgot to close your <head> tag. Your document header should look like this:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml vers="1.0" lang="en"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
...
</body>
</html>
However, I would recommend that you upgrade to HTML 5, which is much better than XHTML. This is a normal HTML5 document:

HTML Code:
<!DOCTYPE html>
<html>
<head>
...your code here...
</head>
</html>
So no messy DTD or XML attributes to deal with. Much easier to use, and much cooler.
Reply With Quote
  #3  
Old 03-10-2010
Child
 
Join Date: Oct 2008
Location: Israel
Age: 28
Posts: 84
Rep Power: 2
Dimkin is on a distinguished road
Re: XHTML transitional question

Thanks for the reply, though my head closing tag is right after the link tag
Code:
<link href="Style.css" rel="stylesheet" type="text/css" /></head>
Reply With Quote
  #4  
Old 03-11-2010
Looking#'s Avatar
Toddler
 
Join Date: Mar 2010
Location: Maryland
Posts: 24
Rep Power: 0
Looking# is on a distinguished road
Re: XHTML transitional question

Ah, I see it now. Good job.

I've taken a look at your code, and here's what I found:

For one thing, your CSS rule for the div "leftmenu" doesn't have a closing curly brace. For another, the float properties in your CSS are what's causing your divs to escape their container. I suggest that you find another way to work out how to get your divs positioned that doesn't use float. Or you could use the "clear" property to tell the left div not to let anything to get on top of it.

Just some suggestions.
Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes 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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML part 6 hayabusa HTML & CSS Articles 0 09-05-2004 03:08 AM
XHTML part 5 hayabusa HTML & CSS Articles 0 09-05-2004 03:06 AM
XHTML part 4 hayabusa HTML & CSS Articles 0 09-05-2004 03:04 AM
XHTML part 3 hayabusa HTML & CSS Articles 0 09-05-2004 03:00 AM
XHTML part 1 hayabusa HTML & CSS Articles 0 09-05-2004 02:58 AM