W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: Is it possible to align by text

From: Stephen Hay <haymail@gmail.com>
Date: Fri, 29 Apr 2011 15:27:07 +0200
Message-ID: <BANLkTimBJGc-NsF_yn1xHZdoq29+GYCqfw@mail.gmail.com>
To: Mark Kenny <beingmrkenny@gmail.com>
Cc: www-style list <www-style@w3.org>
> Recently I had a situation where I wanted to align the right hand side of
> the text with the right hand border of a DIV. The width of the H1 was 100%
> and I wanted it to extend all the way out of view, so couldn't use the right
> hand border of the H1 for alignment.
> You can see the (unfinished) example at beingmrkenny.co.uk/portfolio -- the
> H1 in question is the text "PORTFOLIO" currently in purple and yellow at the
> top of the page.
> The text in that H1 will vary in length, but I'd like to align it by the
> right edge. Obviously there's nothing in the spec at the moment, but I was
> wondering if this would be possible / considered for the future, or if
> there's a way of doing it currently that I'm not aware of.

To be honest, I'm not quite sure this question is at home here in this
mailing list; the discussions here are indeed usually about
(developing) specs. I think something like stackoverflow.com might be
the right place for it.

But I took a look at your page, and it seems that the problem can be
solved with a different approach. Currently you're relatively
positioning your heading from the left side, when you should probably
be using the right side of the viewport as your base, and adjusting
your right-margins and -padding accordingly. Using a percentage width
for your H1 will also make life easier for you.

Stephen Hay

Received on Friday, 29 April 2011 13:27:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:45 UTC