Jump to content

media attribute for <a> tag


Gokhan

Recommended Posts

Hello everyone;

 

I don't understand the usage of the media attrübute for <a> tag. Let us say I write the code below. What does the media attribute do there? It will not open Google in a printable format. The tutorial says it is purely advisory. However the user of the website will not be able to see it. Then I wonder I advise the optimised conditions to whom? Could someone explain me why it is used with <a> tag?

<!DOCTYPE html><html><body><p><a href="http://google.com" media="print and (resolution:300dpi)">Search Engine</a></p></body></html>
Link to comment
Share on other sites

for links.

 

to target lines on a page (except html5)

Edited by niche
Link to comment
Share on other sites

for links.

 

to target lines on a page (except html5)

 

I am sorry but I couldn't understand it. Could you please explain it a bit more detailde. May be it can be better to go with the example above.

 

1) I create a link named "Search Engine" with the <a> tag.

2) The link goes to "Google". href attiribute does this.

 

I understand until now.

 

3) The media attribute says the linked page (Google main page in the example) is optimised for printing with the resolution of 300 dpi. But why would someone need to do this?

 

- The Google homepage will not be open as a printable shape.

- A visitor will not see this information if he/she doesn't view the source code.

 

Then I wonder I am saying "it is optimised for printing with a resulotion of 300 dpi" to whom?

 

 

I am sorry but I also couldn't understand what "to target lines on a page means". Could you please explain a bit detailed?

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...