| | |
div repeat background problem
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
hi guys,
i am currently facing one problem whereby i have a div container with a background-image and i want the background to automatically repeat as the inner divs contents expands. However, if i do not specify any height to the container, the background does not repeat at all even though the inner divs contents are expanding.
here's what i did
when my contents in the inner div grows, the container background does not repeat to cover, i have also tried setting the container height to auto but it doesnt work, if i set height to 100 then it repeats the background for a 100px..
please help.. my html are as follows:
i am currently facing one problem whereby i have a div container with a background-image and i want the background to automatically repeat as the inner divs contents expands. However, if i do not specify any height to the container, the background does not repeat at all even though the inner divs contents are expanding.
here's what i did
HTML and CSS Syntax (Toggle Plain Text)
#container { background-image: url(...); } #inner { top: 10px; left: 25px; position: absolute; }
when my contents in the inner div grows, the container background does not repeat to cover, i have also tried setting the container height to auto but it doesnt work, if i set height to 100 then it repeats the background for a 100px..
please help.. my html are as follows:
HTML and CSS Syntax (Toggle Plain Text)
<div id="container"> <div id="inner"> the contents are all here </div> </div>
•
•
Join Date: Jan 2008
Posts: 79
Reputation:
Solved Threads: 9
#container
{
background-image: url(...) left top repeat;
}in the code above your background will repeated to x and y, use repeat-x if you want your background repeated only in x (left to right)
Or use repeat-y if you want your background repeated only in y ( top to bottom )
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
thanks for your reply,
however i tried background repeat but it still doesnt work..
if i specified the height, then everything is working but i want it to be dynamic according to my contents per page..
please help..
however i tried background repeat but it still doesnt work..
HTML and CSS Syntax (Toggle Plain Text)
#container{ background-image: url(""); background-color: White; background: left top repeat; }
if i specified the height, then everything is working but i want it to be dynamic according to my contents per page..
please help..
Last edited by suchiate; May 7th, 2008 at 12:00 am.
•
•
Join Date: Jan 2008
Posts: 79
Reputation:
Solved Threads: 9
mmm its strange ....
i think i need to see your page 1st
but u can try to add background to your body instead of #container like this
adjust the position based on your need, but its better if u show ur entire page code (url maybe)
i think i need to see your page 1st
but u can try to add background to your body instead of #container like this
body{
background-image: url("");
background-color: white;
background: center 100px repeat-y;
}adjust the position based on your need, but its better if u show ur entire page code (url maybe)
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
thanks for your continuous response rudevils,
however, i finally solved my problem, it was because of the positioning that i have set for my inner and container divs. my container was at relative and my inner was absolute. so i changed my container to absolute and left my inner div at default positioning (no value) and it worked.
I guess i am starting to get better understanding about css positioning. So sorry to crack your head on such a small problem but i really appreciate your help =)
however, i finally solved my problem, it was because of the positioning that i have set for my inner and container divs. my container was at relative and my inner was absolute. so i changed my container to absolute and left my inner div at default positioning (no value) and it worked.
I guess i am starting to get better understanding about css positioning. So sorry to crack your head on such a small problem but i really appreciate your help =)
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
Your background color is overriding the background image, because it is later in the stylesheet.
Then i came and revisit my post, which very luckily saw your post, and made me realized that the background color will override absolute positioning background image, really appreciate your help.
Thanks a million.
Last edited by suchiate; May 15th, 2008 at 1:09 am.
![]() |
Similar Threads
- Firefox background-position problem solved (JavaScript / DHTML / AJAX)
- Child div's (faux columns) showing irregularly in FF (HTML and CSS)
- In navigation display:block; property is giving problem in IE6 (HTML and CSS)
- Placing one div within another (HTML and CSS)
- mac vs windows; help to resolve the problem (HTML and CSS)
- Background question (JavaScript / DHTML / AJAX)
- Bizarre CSS Behavior in Moz Without Border on Div (HTML and CSS)
- CSS browser compatibility ??? (HTML and CSS)
- Desktop background hijacked-NEW Problem (Web Browsers)
- Desktop Background Hijacked-NEW Problem(! Smart Security) (Viruses, Spyware and other Nasties)
Other Threads in the HTML and CSS Forum
- Previous Thread: what's the best css books?
- Next Thread: Code broken in IE - Help School Teacher
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






