Topic: Align without "align=" and "target" (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=11033" title="Pages that link to Topic: Align without &amp;quot;align=&amp;quot; and &amp;quot;target&amp;quot; (Page 1 of 1)" rel="nofollow" >Topic: Align without &quot;align=&quot; and &quot;target&quot; <span class="small">(Page 1 of 1)</span>\

 
krets
Paranoid (IV) Mad Scientist

From: KC, KS
Insane since: Nov 2002

posted posted 08-25-2003 05:58

OK, after searching a bit I found a couple posts on aligning something to the right using margins. But what if you just want to center some text? Do you just use "text-align: center?"

What about the target attribute? Does that have to be done with JS now?

Seems the point of web standards was to make things easier on designers. This doesn't seem much easier to me....

:::11oh1:::

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-25-2003 06:03
quote:
OK, after searching a bit I found a couple posts on aligning something to the right using margins. But what if you just want to center some text? Do you just use "text-align: center?"



If you're just dealing with text inside a block level element (such as a paragraph or div), the text-align attribute will work fine.

If you want to actually center the block level element itself, you set its width, and then use

margin-left:auto;
margin-right:auto;

make sure that (a) the page has a valid doctype, and (b) the element *containing* the element you're centering spans the entire width of the page.

quote:
What about the target attribute? Does that have to be done with JS now?



I think it's coming back in XHTML 2. In the meantime, yeah, use a JS onclick attribute, if you're using XHTML.

quote:
Seems the point of web standards was to make things easier on designers. This doesn't seem much easier to me...



I know what you mean. Keep in mind that the majority of the difficulties come from poor browser implementations; the standards themselves are actually pretty good and getting better. The theory behind it is also very good - separation of content from style and all that. But there's no doubt that sometimes you just have to use a table or two.

[edit: and using tables, I should add, doesn't make a web page non-standard. In fact, you could probably make a primarily table-based design and still have a standards-compliant page. The difficulty you're experiencing comes from making a full-CSS design, not just the usage of standards.]

[This message has been edited by Slime (edited 08-25-2003).]

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

posted posted 08-25-2003 07:01

Don't forget to check the FAQ:
http://faq.ozoneasylum.com/834/



[This message has been edited by ozphactor (edited 08-25-2003).]

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 08-25-2003 14:11
quote:
Seems the point of web standards was to make things easier on designers. This doesn't seem much easier to me...



Nope. The point of web standards was to standardize things, for the benefit of web designers, software programmers, the end user, and a whole slew of other things.

Not to simply make web design "easier".



Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-25-2003 19:13

krets: Yep ozphactor got the target attribute business right (you can use JavaScript or modular XHTML) and this deals wit centring:

:FAQ: How do I get vertical and horizontal centering with CSS?

___________________
Emps

FAQs: Emperor

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

posted posted 08-25-2003 21:25

Emps: About that FAQ... I thought the text-align hack for IE5 was supposed to be applied to the object containing the div you want centered, and not to the div itself.

Something like:

code:
body {
text-align: center; /* centers the div in IE */
}

#centered {
margin-left: auto; /* margin-left and margin-right need to be set independently */
margin-right: auto; /* because the shorthand fails in Opera */
text-align: left; /* overrides the centered text */
}




At least that's how I remember it.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-25-2003 22:09

ozphactor: Yep you are correct - I suspect that I threw that together a little quickly

Feel free to change the FAQ accordingly.

___________________
Emps

FAQs: Emperor



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu