Jump to content

Using CSS with <a> tags


RRRSystems

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

Link to comment
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.

Link to comment
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...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...