1
Mithrandir
Positioning Divs and Spans

I am trying to make a template with divs and spans.

What I need is this:

Text text text (title)
text text text (aligned left) _______ text text text (aligned right)
text text text (aligned left) _______ text text text (aligned right)

Since using divs and spans is the best thing since the wheel (as "people" say it is) I am wondering how I can accomplish this. I can do it in 2 minutes with a table layout, but want to learn about these divs and spans - problem being that the only thing I can get working is with margins and pixel count - and that is just not good enough, since I will not know what the pixel width of the page will be.

Any of you CSS gurus able to help?

2
chapi
Re: Positioning Divs and Spans
  • 2004/8/6 12:19

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22


The code below should basically do what you want!

Here the CSS code

#box {
}

.
title {
}

.
text {
}

.
lefttext {
floatleft;
}

.
righttext {
text-alignright;
}


And that's the HTML.

<div id="box">
<
div class="title">title text</div>
<
div class="text">
<
div class="lefttext">aligned left text</div><div class="righttext">aligned right text</div>
<
div class="lefttext">aligned left text</div><div class="righttext">aligned right text</div>
</
div>
</
div>
</
div>


Hopefully this helps you

3
Mithrandir
Re: Positioning Divs and Spans

Thanks, working.

But geez - unless you KNOW that there is something called float, you wouldn't learn about it. When I've been looking for CSS positioning, all I get is sites with "CSS is totally awesome, people not using CSS are stoopid and you just need these two things: position relative and position absolute" (and what's the deal with calling it CSS layout? I use CSS in my table layouts, too)

4
Alan-A
Re: Positioning Divs and Spans
  • 2004/10/10 9:19

  • Alan-A

  • Not too shy to talk

  • Posts: 191

  • Since: 2004/2/17


Hi,
Quote:
and what's the deal with calling it CSS layout? I use CSS in my table layouts, too

I guess its a question of levels - in "css layout" css is used at the "highest level" for the positioning.
And why do this?
One reason is accessibility - a text reader (an audio browser or browser plug-in for people for reading difficulties) goes through your code from top to bottom. Therefore a table will be read row after row, wheras a css page will be read more like a newspaper - the lefthand column will be read first.
With a table layout which only has one row, as in the main part of the XOOPS standard template, there is effectively no difference, as the code for the first <td> (the left hand column) is read first, the code for the middle column is read next and so on. But with a table with more than one rows the code will probably be read by the text reader differently to the way a sighted reader would work his way through the page.
Hope this helps.

Alan

p.s. when I think of all these organisations for visually impaired people out there, couldn't we help push this subject a little by starting an accessibility forum?

5
studioC
Re:Positioning Divs and Spans
  • 2004/10/10 9:27

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


Quote:
p.s. when I think of all these organisations for visually impaired people out there, couldn't we help push this subject a little by starting an accessibility forum?


joined
michael

6
Alan-A
Re:Positioning Divs and Spans
  • 2004/10/10 10:11

  • Alan-A

  • Not too shy to talk

  • Posts: 191

  • Since: 2004/2/17


Hi,
Quote:
starting an accessibility forum

IMO the most important step would be that we get a simple to use (with comments!) theme/template set together which satisfies the w3c accessibility guidelines.
This package must include template pages for all modules which are delivered with the XOOPS installation package and have a practical name such "standard accessiblity" and only use tables where tables really make sense (where the flow for reading the code and reading the content run parallel).

...and then publicise this new "feature" on the XOOPS site...

But the all encompassing question is who should coordinate this - at the moment I'm not able to commit myself...

Best wishes,

Alan

Login

Who's Online

251 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 251


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits