target attribute via CSS?

  • Thread starter Marcus Stollsteimer
  • Start date
M

Marcus Stollsteimer

Hi group,

is there a css-version of the target attribute, so that
I can express

<a href="gnat.html" target="somthing">Link</a>

by

<style type="text/css">
a { target:something; }
</style>

and

<a href="gnat.html">Link</a> ?


Best regards,
Marcus
 
J

Jonathan N. Little

Marcus said:
Hi group,

is there a css-version of the target attribute, so that
I can express

<a href="gnat.html" target="somthing">Link</a>

by

<style type="text/css">
a { target:something; }
</style>

and

<a href="gnat.html">Link</a> ?

No.

Firstly "target" is an HTML *attribute* not a CSS style *property* and
cannot set or create the attribute. Now you can style all A elements
that have target attributes with the selector:

A[target] { ... }

or only A elements that target a specific frame:

A[target="left_pane"] { ... }

Secondly, the "target" attribute is supposed to be reserved for frame
applications and not to create new browser windows <duck and cover>...

Maybe a little elaboration on what you are trying to accomplish here we
can better advise...
 
M

Marcus Stollsteimer

Jonathan said:
No.

Firstly "target" is an HTML *attribute* not a CSS style *property*
and cannot set or create the attribute. Now you can style all A
elements that have target attributes with the selector:

Sorry, what I really meant is:

Can I replace the HTML attribute with some CSS style property
that has the _same effect_, like

a { some-target-property:something; }

Regards,
Marcus
 
J

Jonathan N. Little

Marcus said:
Jonathan N. Little wrote:




Sorry, what I really meant is:

Can I replace the HTML attribute with some CSS style property
that has the _same effect_, like

a { some-target-property:something; }

I'm sorry did you read my response? I inferred for your question that is
what said:
No.

Firstly "target" is an HTML *attribute* not a CSS style *property* and cannot set or create the attribute. Now you can style all A elements that have target attributes with the selector:

A[target] { ... }

or only A elements that target a specific frame:

A[target="left_pane"] { ... }

Secondly, the "target" attribute is supposed to be reserved for frame applications and not to create new browser windows <duck and cover>...
 
M

Mark Parnell

Deciding to do something for the good of humanity, Marcus Stollsteimer
Can I replace the HTML attribute with some CSS style property
that has the _same effect_, like

As Jonathan said, no. It's not a styling issue, so has nothing to do
with CSS.
 
?

=?ISO-8859-1?Q?G=E9rard_Talbot?=

Marcus Stollsteimer wrote :
Sorry, what I really meant is:

Can I replace the HTML attribute with some CSS style property
that has the _same effect_, like

a { some-target-property:something; }


Maybe there is an answer to your question but right now, it's impossible
to know what you are looking for. "Some CSS style property", "something"
are not what all of us consider as something specific, something
defined, something identified and something clear.

The FAQ on "How to open a referenced resource of a link in a new tab? or
in a specific tab?" may answer you:
DOM:window.open
http://developer.mozilla.org/en/docs/DOM:window.open#FAQ

Gérard
 
M

Marcus Stollsteimer

Gérard Talbot said:
Maybe there is an answer to your question but right now, it's
impossible to know what you are looking for. "Some CSS style
property", "something" are not what all of us consider as something
specific, something defined, something identified and something
clear.

Hi Gérard,

I think I know the answer now (it's not yet implemented),
but what I meant was simply:

html attribute -> css property
<ul type="disc"> -> <ul style="list-style-type:disc;">
<a target="_parent"> -> <a style="gnat;">

what is gnat?

thanks anyway,
Marcus
 
J

Jonathan N. Little

Marcus said:
Hi,

thanks for all your answers, especially Gérard (was my
question really so unclear?), your link led me here:

<http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/>

So the answer seems to be "not at the moment",
but in CSS3 it might be possible to have something like

a { target-name:parent; }

Regards,
Marcus

Again No.

Okay, let's try this a different way. CSS does *not* replace all HTML
attributes, only the attributes with respect to style (presentation) and
not structure and content. Now take the IMG element; the SRC, ALT,
TITLE, are attributes that affect the content but ALIGN or BORDER are a
presentation or styling issue and are replaced with CSS with FLOAT and
BORDER properties. Not only HTML attributes but some HTML tags that
where presentational are replaced with CSS, CENTER, BOLD, FONT, I, SMALL
are examples. If you want to make something bold, then style it so. If
your content requires identifying such emphasis, then structurally mark
the bits with EM, STRONG or <ELEMENT class="SomethingVeryImportant"> and
style accordingly; but whether the emphasized text is bold or red or
italic, or whatever, is a style issue and define it in your CSS.

Now you can build CSS sectors to style specific ELEMENTS base upon HTML
attributes, but your cannot set or change those attributes. We will use
your target for an example, so you're using a frameset right? 3 frames
for this example, 'banner' on the top, 'navbar' of the left and
'content'. With CSS sectors could color all links in on your page base
upon the target value so that links that change the 'content' frame are
colored blue but special links that break out of the frameset are
colored red.

A[target="content"] { color: blue; }
A[target="_top"] { color: red; }
 
M

Marcus Stollsteimer

Jonathan said:
Again No.

Okay, let's try this a different way. CSS does *not* replace all
HTML attributes, only the attributes with respect to style
(presentation) and not structure and content.

I am _very_ aware of that, but sometimes it is not possible
to decide so clearly what is "presentational" and what "structural".
And apparently the people from W3C _did_ think about introducing
such a property. (Or am I misinterpreting the cited working draft?)

Anyway, I do not want to argue about this, it's not that important.

Regards,
Marcus
 
J

Jonathan N. Little

Marcus said:
Jonathan N. Little wrote:




I am _very_ aware of that, but sometimes it is not possible
to decide so clearly what is "presentational" and what "structural".
And apparently the people from W3C _did_ think about introducing
such a property. (Or am I misinterpreting the cited working draft?)

Anyway, I do not want to argue about this, it's not that important.

My intent in not to chastise but to educate. Since you repeat the same
question after being answered gives the impression that you did still
did not understand. The bold text was to emphasize the point for clarity
not to shout. Presentational vs. structural is really not too hard to
determine.

Structural things: <p></p> This is a paragraph, it starts here and ends
here. <h2></h2> This is a heading, it is a level 2 heading.
<table></table>Define tabular data, or <ul></ul><ol></ol >or listed
data. I think you get the point here. Just marks data as to how it
should be treated not how it should look. Say for example <span></span>
Marks some text to be somehow be treated differently but not what that
should be. The style you define for the span will you that . . . the
presentational part

Presentational things: Right justification, left justification. Font
style family or size. Color on background and on and on.

No lets look at your target attribute, would it effect how your link
looks or how it is treated? Most assuredly how it is treated because it
directs what frame the link’s href should effect! So it is structural
not presentational.

The advantage of the separation is we can change how the page looks
without having to re-code all the page just the stylesheet! The old days
with:

<P><FONT FACE="Arial, Helvetica" SIZE=1><CENTER> . . . on every
paragraph on many pages of your website and then you decide you want a
serif font that was bigger and not centered!!! Ugh!

Basically

HTML: Structural things defines what you data is
CSS: Presentational defines how it should look
JAVASCRIPT: Behavior defines events and user interaction

HTH
 
M

Marcus Stollsteimer

Jonathan said:
My intent in not to chastise but to educate. Since you repeat the
same question after being answered gives the impression that you did
still did not understand.

Sorry that I misunderstood your first answer, and thanks for
educating me... But did you have a look at the given link?

Regards,
Marcus
 
J

Jonathan N. Little

Marcus said:
Jonathan N. Little wrote:




Sorry that I misunderstood your first answer, and thanks for
educating me... But did you have a look at the given link?
If you are referring to:
<http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/>

CSS3 is still in development and details are being hashed out. IMHO I
think 'target' structural and should not be part of CSS. There is no
browser that I know of that support the property. Until CSS3 is
finalized and there is basic browser support I would focus on CSS2.1.
 
M

Marcus Stollsteimer

Jonathan said:
CSS3 is still in development and details are being hashed out. IMHO
I think 'target' structural and should not be part of CSS. There is
no browser that I know of that support the property. Until CSS3 is
finalized and there is basic browser support I would focus on
CSS2.1.

Of course (that's why I said "it might be possible").

Regards,
Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top