| | |
Divs not postioned well in main div
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
I am new to CSS and I am having problems with my code. I have created these CSS rules and applied them to the code that follows after the rules.
My intention is to have all my divs line up in a straight line within the searchresultscontainer div. But when I check my results in the browser, none of them are positioned correctly. What am I not getting right?
xhtml code to which CSS are applied:
A would appreciate any help on how to correct this. TIA
My intention is to have all my divs line up in a straight line within the searchresultscontainer div. But when I check my results in the browser, none of them are positioned correctly. What am I not getting right?
CSS Syntax (Toggle Plain Text)
.searchresultscontainer{ width:800px; height:62px; border-style:solid; border-color:#FF0000;} .searchresultsimg{ position:absolute; width:100px; height:60px; background-color:#CCCCCC; float:left; left:0px; border-style:solid; border-color:#9966CC; } /*.searchresultsdetail{ position:relative; width:700px; height:61px; text-align:center; background-color:#CCCCCC; float:right; left:101px; margin:0; padding:0; }*/ .productdescription{ position:absolute; width:300px; height:36px; text-align:left; float:left; left:101px; margin:0; padding:10; border-style:solid; border-color:#FFCC00; } .productmodelno{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:401px; margin:0; padding:10; border-style:solid; border-color:#996600; } .productmodelyear{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:501px; margin:0; padding:10; border-style:solid; border-color:#00FF00; } .productprice{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:601px; margin:0; padding:10; border-style:solid; border-color:#000033; } .productuserid{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:701px; margin:0; padding:10; border-style:solid; border-color:#990000; }
xhtml code to which CSS are applied:
xhtml Syntax (Toggle Plain Text)
<div class="searchresultscontainer"> <div class="searchresultsimg"><!--- creating a resized version of uploaded image of product ---> <cfimage source="#ExpandPath('images/consumer/#Cnsmr_ProductIMAGE#')#" action="resize" width="100" height="60" name="resizedImg" format= "jpg"> <cfimage source="#resizedImg#" action="writeToBrowser"><!---img src="images/consumer/#Cnsmr_ProductIMAGE#"---> </div> <div class="productdescription"><font size="+2">#Cnsmr_ProductDESCRIPTION# </font> <font size="+2"></div> <div class="productmodelno"><a href="showProductDetail.cfm?Cnsmr_ProductCountID=#URLEncodedFormat(TRIM(Cnsmr_ ProductCountID))#">#Cnsmr_ProductMODELNo# </font> </a></div> <div class="productmodelyear"><font size="+2">#Cnsmr_ProductMODELYEAR# </font> </div> <div class="productprice"><font size="+2">#Cnsmr_ProductPRICE#</font> </div> <div class="productuserid"><font color="#000066#" size="+2">#User_id#</font></div> </div> <!--- end of searchresultscontainer --->
A would appreciate any help on how to correct this. TIA
Please check below code. and let me know if it is working
HTML and CSS Syntax (Toggle Plain Text)
.searchresultscontainer{ width:1520px; height:62px; left:14px; border-style:solid; border-color:#FF0000; } .searchresultsimg{ position:absolute; width:100px; height:55px; background-color:#CCCCCC; float:left; left:14px; border-style:solid; border-color:#9966CC; top: 19px; } /*.searchresultsdetail{ position:relative; width:700px; height:61px; text-align:center; background-color:#CCCCCC; float:right; left:101px; margin:0; padding:0; }*/ .productdescription{ position:absolute; width:292px; height:52px; text-align:left; float:left; left:118px; margin:0; padding:10; border-style:solid; border-color:#FFCC00; top: 19px; } .productmodelno{ position:absolute; width:344px; height:57px; text-align:left; float:left; left:461px; margin:0; padding:10; border-style:solid; border-color:#996600; top: 19px; } .productmodelyear{ position:absolute; width:100px; height:51px; text-align:left; float:left; left:816px; margin:0; padding:10; border-style:solid; border-color:#00FF00; top: 21px; } .productprice{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:1159px; margin:0; padding:10; border-style:solid; border-color:#000033; top: 20px; } .productuserid{ position:absolute; width:100px; height:36px; text-align:left; float:left; left:1416px; margin:0; padding:10; border-style:solid; border-color:#990000; top: 19px; }
Thanx,
Shiriyal
http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Shiriyal
http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
You have tangled tags.
Your font tags are not nested entirely inside or entirely outside the div tags. Tag soup always throws the browser into quirks mode. Quirks mode makes divs go crazy.
You need to align your tags like this:
The following does NOT work
Also, the font tag is deprecated. Use the div tag or the span tag with CSS instead.
Your font tags are not nested entirely inside or entirely outside the div tags. Tag soup always throws the browser into quirks mode. Quirks mode makes divs go crazy.
You need to align your tags like this:
HTML and CSS Syntax (Toggle Plain Text)
<div> <font> <div> .... </div> </font> </div>
HTML and CSS Syntax (Toggle Plain Text)
<div> <div> <font> .... </div> </font> </div>
Also, the font tag is deprecated. Use the div tag or the span tag with CSS instead.
Daylight-saving time uses more gasoline
![]() |
Similar Threads
- aligning 2 DIV's aside one another (HTML and CSS)
- [CSS] How to center one div in a main div (HTML and CSS)
- css looks good in IE terrible in FF ... help (HTML and CSS)
- IE problem, can't get 2 divs to show side by side (HTML and CSS)
- HTML/CSS DIV help needed (HTML and CSS)
- DIV help (HTML and CSS)
- Problem with <div> height - Controlling flow from center div (JavaScript / DHTML / AJAX)
Other Threads in the HTML and CSS Forum
- Previous Thread: Turning autocomplete off
- Next Thread: Css border showing double
Views: 521 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart center cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format free frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl






