Forum How do I...?

Inserting CONTENT’s value of meta[name='author'] tag in page

Anas R.
Hi all,

Is there any way to Insert CONTENT’s value of meta[name='author'] tag in page’s margin?
Suppose we have the following under HEAD tag:
<meta name="author"	content="John Smith" />

I want to show the content value in the button margin. I tried this but didn’t work:
meta[name="author"] {
	string-set: meta attr(content);
}
@page {
	@bottom-left			{ content: "© 2012" string(author);}
}

Thanks in advance.

https://richstyle.org

mikeday
Try "string-set: author attr(content)" as the name has to match the later usage of string(author).
Anas R.
meta[name="author"] {
	string-set: author attr(content);
}

@page {
	@bottom-left			{content: "© 2012" string(author);}
}


Didn't work :(

https://richstyle.org

mikeday
Perhaps there is some other issue. Can you try this test document, which works for me:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="John Smith"/>
<style>
meta[name="author"] {
   string-set: author attr(content);
}

@page {
   @bottom-left { content: "© 2012 " string(author) }
}
</style>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
Anas R.
oops... I forget to add this:
<meta name="author" content="John Smith"/>

:oops:

Everything is fine now.. thanks :)

https://richstyle.org

Anas R.
btw.. is it possible to insert a multi-line string to
content:"";
attribute?

https://richstyle.org

mikeday
Yes, like this:
content: "Hello,\A world!";
white-space: pre

The \A is the CSS character escape for the newline character, and the space after it will be ignored and is just there to make sure it doesn't get confused with any following characters.. The white-space property ensures that the newline character forces a line break.