[thelist] CSS: display: block on links

Bill Moseley moseley at hank.org
Sun Jan 14 15:49:54 CST 2007

On Sun, Jan 14, 2007 at 09:51:32AM -0800, Hassan Schroeder wrote:
> > I guess that is possible.  I'd have to go in an add class tags for
> > all those anchors and there's about fifty tables.  It would be harder
> > than that, actually, since I use template macros to display some of
> > the links -- that is the actual <a> tags are generated by macros and
> > the are only sometimes the link I'd want to be display: block.
> ?? There's nothing in your current JS approach that distinguishes one
> link from another "sometimes", so where is that logic?

I think you were suggesting that I add a class tag to the <a> tags
then set display: block in my style sheet on that class (and omit the
<br> tags.

The tables are dynamically generated and macros are used to create the
links.  So a template might look like:

            # display a link to the user's page, and their history 
            # if they have any history records.
            user_link( user );
            IF user.history;
                '<br />'; history_link( user.history );

So, user_link() generates the <a> tag and the user_link() marco
doesn't know if it's the only link or not in the <td>.

I suppose I could do:

    user_link( user, user.history ? 'block' : 'inline' );

but that would mean editing fifty or so templates.

The point of the javascript is so it can be run on any page and the
javascript can figure out by looking at the table column what needs to
be display: block.

> And why would you need to add class attributes to all of the anchors?
> If it's only the links in the table, `td a:link`should do it. Or worst case
> add an id to the table and `table#foo a:link`.

You really mean a:link?  Anyway, that would apply the style to all
links within the <td>.  I only want to apply it if there's only one
<a> within the <td>.

Bill Moseley
moseley at hank.org

More information about the thelist mailing list