30-01-2006, 10:00 AM | #1 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
I've come across something odd. I got text and an image, and I want to align the text to the middle of the image (so that it comes at the middle height of the image), the image should be aligned left and the text centered. For some reason, this's harder than it sounds, as the img-tag's align attribute apparently can only take one parameter, which's either middle or left, but not both, nor's it take two allign attributes. Anybody know how I can still do this? Thanks in advance
|
||
|
|
30-01-2006, 11:08 AM | #2 | ||
Join Date: Dec 2004
Location: Eindhoven, Netherlands
Posts: 1,508
|
Use css!
Code:
<html> <head> <style type="text/css"> img.middle {vertical-align:middle} </style> </head> <body> <p> This is an <img class="top" border="0" src="logocss.gif" width="95" height="84" /> inside a paragraph with centered text. </p> </body></html> this example. If you change the code to the stuff above, you'll see the text aligned to the center of the image (or rather: the image is aligned to the text with its center). |
||
|
|
30-01-2006, 11:39 AM | #3 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
I got that far, but we fixed it now. We set the image as a background image, aligned it left and set the repeat on no repeat. It works now, under Firefox. IE aligns the text at top, though.
Another thing I want to know, is if it's possible to make links target a div. Like if I have a menu div, and all choices need to load in the contents div. Is this even possible? |
||
|
|
30-01-2006, 02:20 PM | #4 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
Double post :whistle: But woohoo! Found it Some CSS, using submit-buttons and readfile() does wonders
|
||
|
|
30-01-2006, 03:04 PM | #5 | ||
Join Date: Dec 2004
Location: Eindhoven, Netherlands
Posts: 1,508
|
You can change the content of any HTML-element, so a <DIV> as well, through the DOM-model. This is kind of tricky, but with a little bit of patience can be done.
Check out: http://www.quirksmode.org/ for a very very indepth tutorial about that. You could also use element.innerHTML to modify the contents. Quirksmode offers a comparison between the two ways as well. It's an excellent site. |
||
|
|
30-01-2006, 04:28 PM | #6 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
I used submit-buttons, disguised as links through CSS (taking away their border, adding a hover-element... which doesn't work under IE, but does under Firefox), used a switch-statement to check for the value sent by those buttons and used readfile() accordingly to load a file into the div. 's That come close to the DOM model, or did I make one of my own?
|
||
|
|
30-01-2006, 06:01 PM | #7 | ||
Join Date: Dec 2004
Location: Eindhoven, Netherlands
Posts: 1,508
|
Mmm... sounds weird But hey, if it works... On the other hand, if you had used DOM, it would have worked in most browsers...
Another good site: http://www.csszengarden.com/ Wicked CSS k: |
||
|
|
30-01-2006, 07:31 PM | #8 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
Hehe, we've seen CSSZenGarden in class... in that one hour we've seen CSS. Good thing I'm good with self-study (especially during especially boring Dreamweaver classes :whistle: That and during exercise days), or that'd've been all I'd've seen of CSS I'll look into DOM tomorrow, though. We'll be done with the end exercise waaaaay too soon, anyways, so I'll have time with heaps (or so I think I will)
|
||
|
|
30-01-2006, 09:20 PM | #9 | ||
Join Date: Oct 2005
Location: ,
Posts: 113
|
Quote:
Code:
<all your html before the div> <?php $page = $_GET['page']; if (is_file($page) * readfile($page); else * readfile("an error page, or you could just echo an error message"); ?> <all your html after the div> |
||
|
|
08-02-2006, 07:52 PM | #10 | ||
Join Date: Jan 2006
Location: ,
Posts: 93
|
http://www.w3.org/
html as it sould be used stick to it to avoid problems like "works on ie and not on firefox" -> the usefull thing is a html validator to check your pages Same goes for css. then you can google for solution if nedeeed |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Html Calendar | Nick | Programming | 2 | 15-10-2006 07:54 AM |
More Html Help | Bobbin Threadbare | Tech Corner | 29 | 14-03-2006 02:33 PM |
Html Scroll To: | Bobbin Threadbare | Tech Corner | 2 | 28-02-2006 05:48 AM |
Java/html - Two Questions ... | swiss | Programming | 12 | 12-02-2006 10:57 AM |
Html Problem | punch999 | Programming | 6 | 16-12-2005 09:07 PM |
|
|
||
  |