[Pro] Adding CSS 'id' to paragraphs

Hi,

Is there a way for me to add an ‘id’ tag to HTML paragraphs? It seems that I can add an id to most HTML elements, but when I type up paragraphs inside of a

then the div does have an id, but not so the individual

elements.

I tried to add them using the Extended button in the Add Style dialog, but that didn’t seem to work.

Cheers,
Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If you explain why you want to do this then we can maybe offer an alternative because I do not think this is possible.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No, not directly in Freeway. I just revved the AddSelector Action to
add it, though. Have a search at ActionsForge – I’ll post it in a
moment.

Walter

On Apr 27, 2010, at 5:46 PM, _savage wrote:

Hi,

Is there a way for me to add an ‘id’ tag to HTML paragraphs? It
seems that I can add an id to most HTML elements, but when I type up
paragraphs inside of a

then the div does have an id, but not
so the individual

elements.

I tried to add them using the Extended button in the Add Style
dialog, but that didn’t seem to work.

Cheers,
Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If I had something like this:

This is a paragraph

This is a paragraph

then I could refer to the individual paragraphs from my javascript/jquery directly. At the moment I iterate over the children of the div, which is a little weird?

On 27 Apr 2010, 9:59 pm, DeltaDave wrote:

If you explain why you want to do this then we can maybe offer an alternative because I do not think this is possible.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walter

Just trying it out and when I select a Paragraph then the ID field is not available for typing in but the class field is.

All the others are OK - TR, TD, etc.

What am I doing wrong?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That means you’re using the wrong form of the Action. That version is
for applying to a text container, like a DIV or TD. If you think about
it, there’s no way that it could work in that context, because there
might be more than one paragraph inside that container.

Try this: Double-click inside the paragraph you want to modify. You
can do this at the beginning, the end, or in between two words if you
like. Now from the main menu choose Insert / Action Item /
AddSelector. Click once on the little Action Item in your run of text,
and look in the Actions palette. There will be an ID and Class field,
both available for text entry. Be sure to enter a valid legal ID, I
don’t police this input at all!

Walter

On Apr 27, 2010, at 7:32 PM, DeltaDave wrote:

Walter

Just trying it out and when I select a Paragraph then the ID field
is not available for typing in but the class field is.

All the others are OK - TR, TD, etc.

What am I doing wrong?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I tried the AddSelector action, and it seems to work for the paragraph.

Now I’ve got this:

But in addition to that, the id is added to the “center” CSS class in the header of the HTML document. That means that every item that uses that CSS class gets this id assigned. Is it possible to restrict the id to the item of the AddSelector only, without making it available in a class?

Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think you might not understand how classes work. You can apply as
many different classes to a single object as you like. You could have
<p id="foo" class="bar baz blah fooey">text</p> and that would be
perfectly valid.

The classes are a space-separated array of individual names. Each one
might carry a different set of attributes back in the stylesheet(s),
some of which might override one another, and the last one “wins” any
conflict.

Conversely, you can only have one ID, and it has to be page-unique and
it cannot contain spaces. By the way, the f-lp class is added by
Freeway, it means “this is the last paragraph” which means it gets no
margin-bottom or space-after in the DTP parlance.

Walter

On Apr 27, 2010, at 8:34 PM, _savage wrote:

I tried the AddSelector action, and it seems to work for the
paragraph.

Now I’ve got this:

But in addition to that, the id is added to the “center” CSS class
in the header of the HTML document. That means that every item that
uses that CSS class gets this id assigned. Is it possible to
restrict the id to the item of the AddSelector only, without making
it available in a class?

Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Right, I understand that.

What I was asking was this: now the paragraph has an id associated directly (through

but also through the css class center. In the case of the code generated by Freeway, both ids are the same and so I assume that’s ok. If, however, the id defined in the stylesheet was different from the id defined for p (e.g. .center { id; foo; }, which one would win then?

Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Class and ID are different in some ways, and similar in others. A
class is like a group affiliation, like saying you belong to the
choir. That’s not as strong an identifier as saying your name is Jens.
If someone says your name, you turn your head, right?

So class and ID are entirely different from one another. One is a
group, and you can belong to many different groups while remaining an
individual. The other is a proper name, and in the rules of HTML, only
one element on any given page may have any given ID. So there would
never be another #foo on your page, while many different elements
could have the same class as #foo. And every object on the page can
have its own (unique) ID and every object on the page can belong to
one or more classes, too. They can all belong to the same class if
they need to for some reason, although that’s not likely necessary.

So imagine if you had two different sets of style attributes applied
to one paragraph. One, through class, set the type color to black. The
other, through ID, set it to white. If all else is equal, then the ID
would “win” and the type would be white.

Generally, you want to think about which one to use depending on how
many other things need that same attribute. If there’s more than one
thing that needs that particular set of styles, then you would use
class. You set it once, apply it to many different things.

So if you wanted all of the type on one side of your page to be
Georgia, you could create a class that had only the font-family
attribute, set to Georgia, and you could apply that class to each
paragraph on that side of the page. (More likely, you would apply it
to a container object, like a DIV, that held all of those paragraphs,
so you wouldn’t have to add it to each paragraph separately. But then
if you also wanted the third paragraph down to be blue, you could
create another class with just the color blue in it, and apply that
class to the paragraph as well. So your third paragraph could be <p class="blue georgia">some text</p>

Now, let’s say you wanted the first H2 on the page to be much bigger
and bolder than its brothers, for design reasons. Let’s say also that
you don’t want to set that one tag to be H2 and all the others to H3,
because your semantic hierarchy dictates that all H2s are equal. It’s
just that you need this first one to be bigger and bolder because it
will make the page look better or more balanced. So you set all the
attributes that the H2 tags have in common in either a class style or
simply in the H2 tag style itself. Then you make a single ID-based
style that will turn your first H2 into what you want. So for that
one, you would add a class and an ID, and the ID would “win” so your
H2 would inherit all of the properties of the class (or tag) style,
plus all the extra juice from that one ID style.

Walter

On Apr 27, 2010, at 11:33 PM, _savage wrote:

Right, I understand that.

What I was asking was this: now the paragraph has an id associated
directly (through

but also through the
css class center. In the case of the code generated by Freeway,
both ids are the same and so I assume that’s ok. If, however, the
id defined in the stylesheet was different from the id defined for p
(e.g. .center { id; foo; }, which one would win then?

Jens


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That means you’re using the wrong form of the Action.

I understand now.

I found it counter-intuitive to insert an item in the para to add the ID. To me the logical way would be to select a run of text (a para or part para) and add it that way.

But now I know!

Thanks once again for your enlightenment.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I agree. I wish that was possible within an Action, too. But it’s not,
because text doesn’t get the same object status as its container, and
Freeway restricts the container status to “things you can draw”.

Walter

On Apr 28, 2010, at 4:07 AM, DeltaDave wrote:

To me the logical way would be to select a run of text (a para or
part para) and add it that way.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options