Making sawdust
Join Date: May 2004
Location: Minnesota
|
Im trying to pick up where i left off a few years back with html coding and am trying to teach myself CSS at the same time. Im want to go full xhtml strict but I am running into problems with layout. I read that you are not supposed to use tables for page layout anymore and i am trying to solve what looks like it should be a simple problem, but the answer escapes me.
I want a simple gallery page that has say, 9 images arranged in a 3x3 grid. I can place this on the page without issue, but without the images being placed in a table, their arrangment changes should you resize the browser window. How can i fix this? edit: here is an example of what i am trying to do: http://www.davidlegatt.com/layout/ Last edited by ThunderPoit : 2006-08-25 at 00:30. |
quote |
Totally awesome.
|
You could always center the middle images and make them absolute and make the others relative or absolute to them.
|
quote |
Microbial member
|
Or you could specify a width and/or min-width for the <p> which contains them.
By the way, you need to close that <p> element. |
quote |
Senior Member
Join Date: Jan 2005
Location: London, UK
|
Quote:
http://validator.w3.org/ |
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
i put that together in 2 min :P
ill get the <p> taken care of later today, and ill try that min. width. thanks |
quote |
Microbial member
|
Quote:
For Safari: http://www.zappatic.net/safaritidy/ For Firefox: https://addons.mozilla.org/firefox/249/ -S |
|
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
I built a gallery software of sorts on my drewprops.com website and it seems to work okay, you might go look at my code and d/l my stylesheet to see what I did. Please note that I built that a year ago (I understand stylesheets a bit better now).
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
wow, that was simple enough, all i had to do was set it with a width of 500px and it held its shape. Unfortunatley, when i did this, it stopped following what was set in the body for centered alignment.
also, even tho the image physically stops at the red line, there is some spacing between all of them, otherwise, it would be only 450px accross. is there a way to eliminate this spacing? |
quote |
Microbial member
|
Quote:
|
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
i set them to 0 px and it made no difference. it just seems very odd to me, even without the stylesheet, there is space between them
is it because i defined the width and height of each one? |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Do you have any stray actual whitespace in the HTML? If there is any, that can cause horizontal gaps.
Do tighten up the vertical gaps, set your line-height to 0. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
the only white space i have is the indents i used in the nesting of the tags. can this cause actual issues with the layout of the page?
also, any thoughts on the alignment part? |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Quote:
I actually tried this on a copy of your source. Removing the whitespace fixes the horizontal gaps between the images and setting line-height to 0 fixes the vertical gaps between the images. Quote:
Code:
.album {
width: 500px;
line-height: 0;
margin: 0 auto;
} The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
||
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
so let me get this straight: in order for the page to look how i want, my code has to be a huge jumbled mess?
|
quote |
Veteran Member
Join Date: Jun 2004
|
Quote:
|
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
ok, i think i can live with formatting it like this:
Code:
<img><img><img><br> and still have it render correctlythanks guys |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Quote:
![]() If you ever discover a way around that, let me know! ![]() |
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
it wasnt the tabbed indents, it was the linebreaks after each image tag. so its not a completely jumbled mess, but it was not as clean as i like to keep my code
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
To clarify, the problem is any whitespace between two specific inline (img has display:inline by default) elements that you want to touch.
So, this is okay: [html]<p> <img /><img /><img /> <br /> <img /><img /><img /> <br /> <img /><img /><img /> <br /> </p>[/html] ...because there's no whitespace between the adjacent images. These are not okay: [html]<p> <img /> <img /> <img /> <br /> <img /> <img /> <img /> <br /> <img /> <img /> <img /> <br /> </p>[/html] [html]<p> <img /> <img /> <img /><br /> <img /> <img /> <img /><br /> <img /> <img /> <img /><br /> </p>[/html] ...because any space, tab, or new line will be collapsed into a single space character and inserted between the output. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
one last quick question. what does margin: 0 auto; do?
|
quote |
‽
|
Quote:
|
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
ahh, cool
|
quote |
Veteran Member
Join Date: Jun 2004
|
Quote:
In pseudocode: Code:
take the html file text
split into sections of text not between tags, and text between tags
for sections not between tags
strip all whitespace
done I believe anyone who has ever parsed XML with Perl, Python or similar fast-to-use language would do this in fifteen minutes. Sadly, I haven't.I did a little surfing and am now assured that the problem (ignoring whitespace that is not inside tags) is simply impossible to fix inside HTML/CSS, because in HTML the linebreak is as significant as the letter 'a'. Neither can be stripped out with CSS. This problem wouldn't exist in CSS formatted XML, because between-tags whitespace means nothing in XML. CSS3 drafts contain something to strip out whitespace but CSS3 is a long way to the future and drafts are... just that. |
|
quote |
Lovable Bastard
Join Date: Dec 2005
Location: Boston-ish
|
Quote:
![]() Seriously, though, will this work with Shiira or is their a Shiira version? Last edited by Kraetos : 2006-08-28 at 13:26. |
|
quote |
Microbial member
|
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Web Designer Noob Needs Schooling | atomicbartbeans | General Discussion | 5 | 2005-09-18 04:58 |