getting attribute from parent selector is CSS using content:attr();

Viewed 9774

Hey I am trying to place the 'title' attribute of a <section> tag inside a <h3> tag located just below and inside the <section> tag.The following works

   <section title="General Information">
       <h3>General Information</h3>
       ....
   </section>

what I would like to do is not repeat 'General Information' inside the <h3> tag but use CSS content along with attr() to get the info inside of the tittle attribute in the <section> tag and place it inside the <h3> tags.

   <section title="General Information">
       <h3></h3>
       ....
   </section>

   section h3:after 
   {
       content:attr(title);
   }

This as expected looks for the 'title' attribute inside of the <h3> tag instead of the <section> tag. Is there any way I can achieve what I am trying to accomplish? Is what I am trying to accomplish the right way of doing things? I know I could skip the <h3> tags altogether and format the <section> tag to display whatever text is in 'title' attribute the same way that the <h3> tag would.

1 Answers
Related