Jump to content
Sign in to follow this  
RRRSystems

Using CSS with <a> tags

Recommended Posts

Hello, I have been looking for a way to use CSS to spectfy Anchoe Attrubutes.I have the following HTML: <a title = "Privacy Policy in (.pdf) Portable Document Format." href = "/Document/Privacy-Policy.pdf" target = "_blank"><u>Privacy Policy</u> </a> Is there a way of using CSS to contain some of the HTML: <a class = "New-Window" id = "Privacy-Policy"><u>Privacy Policy</u></a> Something like this in CSS:.New-Window{ target:"_blank";} #Privacy-Policy{ href:"/Document/Privacy-Policy.pdf"; title:"Privacy Policy in (.pdf) Portable Document Format."} I cannot seem to get anything like this to work.It would make changing <a> items on multiple HTML pages. Thanks, Raney

Share this post


Link to post
Share on other sites

it won't work because CSS is supposed to be removed from the markup. CSS is for presentation, HTML is for markup. Given that, you could use a server-side language or JS to setup some sort of template (or function) to manually do that. Ideally, it would be better to compile the template on the server side.

Share this post


Link to post
Share on other sites

Thanks, That is probably why I could not get it to work! I am planning a group of projects that are to be used as examples for creating the same site taking a different approach. The first is the current and main project using: HTML, CSS and JS. I will now use JS to accomplish most of the task.If people do not have Scripting enabled all they will get is a basic Introduction page and a link to the Table of Contents.I have checked for statistics on the number of people with Scripting disabled and have decided that I do not need to write so much, for so few.I will have a notice that Scripting is required and a link to a document explaining what Scripting is, and how to enable it. Now I will add two more examples to the project: HTML Only, and HTML with CSS Only.With only a Home Page and a link to the Table of Contents this will not add much to the these two will not add that much to the entire project.I can only think of what the HTML Only code will look like. Thanks,Raney

Edited by RRRSystems...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...