| | |
Using Div Tags with CSS question
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 6
Reputation:
Solved Threads: 0
Hello,
So i need some help. i have currently been working on a website for a competition and i ran into a problem. I am using <div> tags and calling the id from the css. i have seperate id's classes and basic tag set up in CSS. the only problem is that i have ran into a current problem of having only the header div and left div tag appearing right, but not the body div tag. the body div tag sits on the bottom. I am using Microsoft Expression Web2 and tried moving them, but it came with a fixed attribute. i know that in the past the fixed attribute does not work with firefox and causes a mess if not set correctly. Would anyone know any way to help me out?
Here is my code:
Any help will be greatful. I am currently competing in the Buisness Profesionals of america competition in high school. so this is still a learning process.
So i need some help. i have currently been working on a website for a competition and i ran into a problem. I am using <div> tags and calling the id from the css. i have seperate id's classes and basic tag set up in CSS. the only problem is that i have ran into a current problem of having only the header div and left div tag appearing right, but not the body div tag. the body div tag sits on the bottom. I am using Microsoft Expression Web2 and tried moving them, but it came with a fixed attribute. i know that in the past the fixed attribute does not work with firefox and causes a mess if not set correctly. Would anyone know any way to help me out?
Here is my code:
HTML and CSS Syntax (Toggle Plain Text)
/* Enter basic CSS for XHTML PAGE */ body { background: #FFFFFF; margin: 0px 0px 0px 0px; } /* Enter ID for XHTML PAGE */ #DC-Header { background-color: #FF5B60; font-family: "Times New Roman", Times, serif; font-size: large; font-style: normal; letter-spacing: 3px; text-align: center; height: 120px; } #DC-Header-Img { text-align: left; width: auto; height: 120px; border: 0px; border-color: #FFFFFF; vertical-align: middle } #DC-Left-Bar { /* Size and General attributes of the Left Bar */ width: 150px; height:700px; position:relative ; left: -5px; background-color: #ABF2F8; padding-left: 10px; /* Border Attributes */ border-right: thin; border-right-color: #FF5050; border-right-style: solid ; border-right-width: thin ; } #DC-Body { background-color: #FFFFFF ; position:relative ; width:700px; height:700px; } /* Enter Classes for XHTML PAGE */ .Header-Font { text-align: center; font-family: "Times New Roman", Times, serif ; font-weight: lighter ; font-variant: normal; color: #000000; font-size: x-small ; position:relative; display: block; } .Left-Bar-Links { /* Font attributes */ vertical-align: top ; text-align: left ; font: menu ; font-family: "Times New Roman", Times, serif ; color: #000000; font-size:medium ; font-weight: normal ; }
HTML and CSS Syntax (Toggle Plain Text)
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Washington D.C. Buissness Profesionals of America 2010</title> <!-- Insert of CSS Document --> <link rel="stylesheet" href="StyleSheets/styles.css" type="text/css" /> <!-- End of CSS Document --> </head> <body> <!-- Insert Header --> <div id="DC-Header"> <div id="DC-Header-Img" ><img src="tizagSugar.jpg" alt="Washington D.C. Banner" /> <font class="Header-Font">Washington D.C. BPA 2010</font> </div> </div> <!-- End of Header --> <!-- Begin of Left Bar --> <div id="DC-Left-Bar"> <p class="Left-Bar-Links" ><a href="http://www.whitehouse.gov">Washington D.C.</a> </p> </div> <!-- End of Left Bar --> <!-- Beging of main body --> <div id="DC-Body" style="left: 158px; top: -698px" > sadsad </div> <!--End of main Body --> </body> </html>
Any help will be greatful. I am currently competing in the Buisness Profesionals of america competition in high school. so this is still a learning process.
•
•
Join Date: Jan 2009
Posts: 93
Reputation:
Solved Threads: 13
0
#2 Oct 10th, 2009
You can use absolute position property to move where you want. The relative position left the extra white space after it positioned. The absolute position doesn't left the white space and it can move exactly where you want. If it's parent has the position property of relative, it will calculate and position from it's parent. If not, it will calculate and position from the browser.
Sorry about for my English skill. I hope you will be ok.
HTML and CSS Syntax (Toggle Plain Text)
CSS: #parent { position: relative; width: 100%; height: 400px } #child { position: absolute; top: 50%; left: 50%; width: 200px; height: 200px } HTML: <div id="parent"> <div id="child">It relative to its parent element and absolutely position from 50% of top and left.</div> </div>
Sorry about for my English skill. I hope you will be ok.
•
•
Join Date: Jan 2009
Posts: 93
Reputation:
Solved Threads: 13
0
#4 Oct 13th, 2009
There is p element in your DC-Left-Bar, The p element has margin. So, you can break the margin property.
Good Luck..
HTML and CSS Syntax (Toggle Plain Text)
#DC-Left-Bar p { margin: 0; }
•
•
Join Date: Jan 2009
Posts: 93
Reputation:
Solved Threads: 13
0
#5 Oct 13th, 2009
Never forget some block elements have their own margin and padding. Also headings and list-items have the default margin and padding. The margin and padding properties are depending on the browser types. So, you must always set the margin and padding values to the same result for all browsers. Sorry for my English skills.
![]() |
Similar Threads
- Putting two p or div tags horizontally aligned on same plane (HTML and CSS)
- Unable to apply style to div tags inside form (HTML and CSS)
- DIV & CSS (HTML and CSS)
- XHTML empty DIV tags (HTML and CSS)
- Firefox hates my CSS now so does IE (HTML and CSS)
- About DIV tags (HTML and CSS)
Other Threads in the HTML and CSS Forum
- Previous Thread: Help creating div for drag and drop
- Next Thread: <td nowrap="nowrap" /> is not working in IE8
| Thread Tools | Search this Thread |
@param acid2 actionlistener ajax asp automation background beta body browser bug c++ calendar cart cgi changeable checkbox code css current design developer development doctype dom dreamweaver editor element explorer firefox form format functiontesting google gridview gui guidancer head hover html ide ie7 ie8 iframe include internet java javadoc javascript jlabel keyword layout marquee microsoft mysql navigationbars news opacity paging parameter perl photoshop php positioning post problem schools security shopping singleton source static studio tag test testautomation training ui unicode url validation vb vbulletin visual visualization w3c web webdesign website wysiwyg xhtml xml






