Comic Fury Webcomic Hosting - Extending background to accomodate content. Help please?

You are not logged in. Log in, Register, More info
Forum > Layouts, HTML, CSS & Javascript > Extending background to accomodate content. Help please?
Pages: [1]

"Extending background to accommodate content. Help please?", 30th Apr 2012, 12:13 AM #1
Aramena♀

User avatar
Posts: 4
Referrals: 0
Registration date: 29th Jul 2011
Location: Canada
Okay so. I have spent the last several hours trying to find a tutorial or guide on how to do this specific thing but have come up empty handed, so I will post my question here.

Situation:

I have a layout which I selected from the list of available ones, which I have been modifying as I go to properly display the way/colors/images that I want it to. I do not know very much HTML/CSS and have been grabbing what I can from guides and tutorials and patching it in, so I have VERY rudimentary understanding of how any of it actually works.

Problem:


I have a background image that I want to use. This background image is exactly the right size to frame my comic as seen here: http://displaced.thecomicseries.com/comics/ However when I use this for the other pages, the content is often longer than the actual image (such as on the cast page). As such, I learned that I needed to cut the images into segments in order to have a "middle" which can loop itself and stretch automatically to the size of the text/content on that page. I cut the image in three, with the looping bar just at the bottom of the background character's feet. I do not want to have my content stretching vertically beyond the actual frame of the image, so I need to stretch the image vertically down so that it will display correctly.

That being said, I have absolutely no idea how to actually edit my layout to implement this. I tried playing with the header but I had it hidden because it displays text (which I do not want but do not know how to get rid of without screwing myself, as the text is already on the background image itself, so I don't need the extra bland, white text). Help please!




Overall HTML







Layout CSS


30th Apr 2012, 7:09 AM #2
Kyo♂
I got to choose mine
User avatar
Posts: 6890
Referrals: 0
Registration date: 6th Jul 2008
Location: Germany
uhm, try something like:

.textcontent {
background-color:#the-color-of-your-choosing-here;
}


also it would be nice in the future if you could wrap long passages of code in code tags, and spoiler tags around those
_______________________
hello
30th Apr 2012, 5:52 PM #3
Aramena♀

User avatar
Posts: 4
Referrals: 0
Registration date: 29th Jul 2011
Location: Canada
Ah, sorry about that. I wasn't aware I should do that (was quite frustrated at the time), but I have edited it now to display as code and spoiler tags.

As for the text area, I don't think that solves my problem per se. If I edit the text area to be the background color I want that would certainly accomplish the very basic of what I want in theory, but the bottom of my background image would not move/extend downward to accommodate text content as well (unless I am wrong, and I may certainly be wrong?). Wouldn't it just stretch the content vertically beyond the image, with a similar color background? I need to loop the image itself (just the center where it CAN be looped).

Will this require me to put the header and footer as both the top and bottom of my spliced image respectively? I have a custom footer which hovers over the rest of the site which I would like to keep if at all possible.
30th Apr 2012, 6:05 PM #4
Kyo♂
I got to choose mine
User avatar
Posts: 6890
Referrals: 0
Registration date: 6th Jul 2008
Location: Germany
oh, I get it now. You're looking for the background-attachment css value.

Note that this will not stop some of the text from overlapping, if the monitor is taller than the background image accomodates. You could also size the text area a certain height and use the "overflow:auto;" css value, to add a scrollbar to that container
_______________________
hello
30th Apr 2012, 6:26 PM #5
Aramena♀

User avatar
Posts: 4
Referrals: 0
Registration date: 29th Jul 2011
Location: Canada
I had thought of the scroll bar method but I am not so fond of on-page scroll bars. I would rather an image which can be looped infinitely downward. I am a little confused by the background image accommodating the monitor though. If the image is set to auto-loop spliced bars to expand the content area before it reaches the footer, wouldn't that just extend the whole page until the end of the content? Sorry, my grasp of CSS is really not great.
30th Apr 2012, 11:41 PM #6
Dodom♀

User avatar
Posts: 422
Referrals: 0
Registration date: 6th Sep 2009
Location: Québec
I can think of a way to do it but it's just an idea, I don't know all the exact commands by heart, so I'll just write the main lines here and we'll see if the concept is good at least.


Make the looping part of the image the actual background.
Right after the background-image line, add background-repeat:repeat-y;

So you'd have a whole background of the looping pattern from top to bottom of the page.

In the HTML part, you add the following:
<DIV CLASS="tophalf"><IMG SRC="top-half-of-the-background.jpg"></DIV>

In the CSS part, you need to define the tophalf class:
.tophalf{
position:absolute;
top:0px;
left:50%
margin-left:-500px;
z-index:0;
}
The margin-left value should be half the width of the background image.
Now, I never used the z-index property, I'm not sure it'll behave right. Maybe it'll be necessary to add a superior z-index to the header and other classes that need to stack over it.

If that all works, the top part of the background should cover the first few repeats of the looping part, and it should be inserted behind the page contents.
_______________________
image
1st May 2012, 1:14 AM #7
Kyo♂
I got to choose mine
User avatar
Posts: 6890
Referrals: 0
Registration date: 6th Jul 2008
Location: Germany
if you want multiple backgrounds in kind of a hierarchy you can also just have two divs within each other, and give the inner one the repeating background. This is all sort of complicated if you don't use css3 (which isn't universally supported yet, though we're getting there)
_______________________
hello
1st May 2012, 1:44 AM #8
Dodom♀

User avatar
Posts: 422
Referrals: 0
Registration date: 6th Sep 2009
Location: Québec
Or tables. Tables can nest too.
_______________________
image
Forum > Layouts, HTML, CSS & Javascript > Extending background to accomodate content. Help please?
Pages: [1]