Jump to content


Photo

CSS Height Woes


  • Please log in to reply
12 replies to this topic

#1 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 17 December 2007 - 06:42 PM

Hello everyone... I recently decided to get back to modding, and because of that I want to redesign my website. The current one was EXTREMELY buggy (and pretty durned ugly), so I decided to do a complete re-do from scratch. I'm not a complete idiot when it comes down to website design, I am fluent with HTML and Javascript, beginner with PHP and decent with CSS.

Anyway, onto the problem(s):
1: HUGE Problem, but it can wait. The website doesn't work properly with IE... I have a bunch of divs' that overlap eachother. In Firefox, thats OK but with IE it shoves the whole darn thing to the bottom in order to avoid overlap.

2: Another HUGE problem, and this is the one I am worried about. Website link (ignore the green box and all the borders, I am still in early development stages after all). You see the are were the news is at? Along the sides there are two transparent strips... Which are supposed to be filled with a border image. If I define a height for the border image, it works fine... However I can't know what the maximum height for news will be! Is there any way to match the height of one div with the height of another? The other one (the mainbody div) doesn't have a defined height... Its simply filled up by the news include. Any ideas?

Edited by Fingulfin, 17 December 2007 - 06:43 PM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#2 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 17 December 2007 - 07:50 PM

1. IE (depending on version) can be a pain with these things. You might try to use IE-specific stylesheets or CSS hacks to "fix" things for IE users.

2. Famous problem. I usually solve that by adding two extra divs around the main div and use those two to display the borders. The extra divs will then automatically expand to the same height as the main div. Just be sure to set the margin and padding correctly.
Alternatively, use tables (not my personal favourite).
Or you can wait until CSS3 is supported by all browsers :lol:

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#3 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 18 December 2007 - 03:13 AM

Thanks, I used the double Div Surrounding and got it to work ;) Feel free to check it out (using Firefox :crazed: )here!

Another problem now (sorry...) Try resizing the screen. You will see that the bottom bar and the side bars don't resize, but the top bar does... Any ideas as to why? I've tried moving the other bar's divs into other divs, but its all one confusing jumble right now (like 5 million container divs right now).

Any help is appreciated!

Edited by Fingulfin, 18 December 2007 - 03:20 AM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#4 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 18 December 2007 - 04:27 PM

I'm not sure what bottom bar exactly you're talking about, but the top bar resizes because the width is set in percent, whereas the sidebars have their width in pixel values.
Or do you mean the bars in the main body?

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#5 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 18 December 2007 - 07:20 PM

Sorry, guess I was being a bit vague... This is what I am talking about:
Posted Image

Posted Image
Red Resizes, while Blue does not. I don't really care how I fix it (whether red stays the same size or blue goes with red), I would just like them to do the same thing.

Thanks for the help btw :crazed:
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#6 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 18 December 2007 - 07:53 PM

I tried to edit some things with minor success, but it's just too much of a mess of containers and unused style definitions :crazed:
Maybe if you cut out the unused parts of the CSS file and put some HTML comments like:
</div> <!-- end of leftdecor2 -->
then I might be able to help more.

Oh, and by the way: strip the whole HTML definition elements like <html>, <head>, <body>, etc. out of your news template. Atm you've got them like 4 times in your sourcecode. The template should really only contain elements that can be output repeatedly ;)

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#7 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 18 December 2007 - 07:57 PM

If I remember correctly (and I do remember correctly) you designed my original news template :crazed:

I'll add more comments too. I deleted a good deal of unused DIVs and tried to make it less confusing, but recently I have been working on the navigation menus. I'll upload an updated version soon ;)
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#8 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 18 December 2007 - 08:28 PM

That's impossible. I am not responsible for the template mess. No way :crazed:
You'll have to fix it eventually though.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#9 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 19 December 2007 - 05:18 AM

Already done :crazed: All the CSS is in my external Stylesheet now, and all extra tags are gone. Working on general appearance now, I'll find a solution to the resizing problem later.
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#10 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  •  Friendly neighborhood standards Nazi

Posted 19 December 2007 - 02:07 PM

Firstly, good on you. If its worth doing, its worth doing right, even if it means tackling CSS layouts for the first time, which is a scary time for all of us :crazed:

I'll have to go over this again sometime if problems persist because I'm tired, its late, and I skimread it. A word of advice though; KISS. Keep It Simple Stupid. Part of the beauty of CSS is its simplicity. I mean hell, whats the complex computer speak you need to make a paragraph red in CSS? color: red. Now, layouts are seldom that simple, but if you are trying to place a box there, do not turn it into pass the parcel, then hope one of them is defined correctly. Part of the concepts behind CSS is a seperation between presentation and markup, so avoid any presentational markup; no <b>'s, no structual <br />'s, and definately no <center>'s, but also no nesting elements for the sake of a specific technique. Sometimes its good to add hooks, extra classes and element structuring, for later presentational flexibility, but divitis seldom helps.

Sleepy rant aside, floats can be very moody, particuarly in IE, and if they don't have the right room, they just jump out the way. Besides IE having some float issues anyway, different browsers have different default styles for elements, critically, these include margins and padding, so unless you define these for everything (or just wipe all at the start with the * selector), your sizes are going to be different crossbrowser.
Now, floats not being ideal for positioning like this, we fall back to CSS's simplicity. Want to position an element? Try position :p "position: absolute;" will absolutely position an element where you define it to be, using top, left, and/or bottom, right properties, absolute to the page. "position: relative" will move it relative to where it would be (static being where it normally is), and fixed would place it fixed in the viewport, so won't move when you scroll. Lost a fantastic article that would clear that up better, but I can still offer a link to a site devoted to simple layout techniques. Read this (glish.com/css/)

World Domination Status: 2.7%


#11 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 19 December 2007 - 07:09 PM

I've developed with CSS before, on an unreleased website that works with both IE and Firefox :p Three columns as well. Just last week I made this website too, which doesn't contain complex CSS, but it has some in it anyway. I work with XHTML - STRICT, which also means that I don't work with outdated tags ;)

Thanks for suggesting position: absolute though... I had thought about it earlier, but I was kinda nervous about using it because I hadn't used it before.


EDIT: ACK... What on earth is IEs problem??? Why must it be so evil :blink: LINKY

As you can see, in FF it keeps the news inside the main body. With IE, it just kinda sits on top of the page :crazed:

EDIT2: WTFudge cakes... I added in comments like DLotS suggested (thanks by the way, now I can read it alot easier!) and now it aligns in IE properly. 100% Properly. I don't know what on earth happens, but it seems to be working splendidly! Next step, replace Floats with Position: absolute

EDIT3: Done with replacing all the floats, it works splendidly in both IE and FF. It even resizes beautifully! Thanks guys for all your help :w00t:

Edited by Fingulfin, 20 December 2007 - 01:49 AM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#12 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  •  Friendly neighborhood standards Nazi

Posted 20 December 2007 - 02:20 AM

Its not valid XHTML though, strict or otherwise (validation results) :crazed:
Also, IE8 Passes ACID2, so should get easier to be work with :blink:
Looking good so far though, but I'd also add some padding to the news, give a gap between the border and content.

World Domination Status: 2.7%


#13 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 20 December 2007 - 03:09 AM

The site is nowhere near completion... all I fixed was my CSS Woes. Getting everything validation-perfect is the LAST step, as is beautification :blink:

PS: 3/4 of the validation problems lie with Masternews, not me :crazed:

Edited by Fingulfin, 20 December 2007 - 03:11 AM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users