Jump to content

Is there a way I can a set of tags with one tag?


Norman

Recommended Posts

I have this code:CSS:

.b1, .b2, .b3, .b4 {font-size: 1px; overflow: hidden; display: block;}.b1 { height: 1px; background: #888; margin: 0 5px;}.b2 { height: 1px;background: #ddd; border-right: 2px solid #888; border-left: 2px solid #888; margin: 0 3px;}.b3 { height: 1px; background: #ddd; border-right: 1px solid #888; border-left: 1px solid #888; margin: 0 2px;}.b4 {height: 2px; background: #ddd; border-right: 1px solid #888; border-left: 1px solid #888; margin: 0 1px;}.contentb { background: #ddd; border-right: 1px solid #888; border-left: 1px solid #888;}.contentb div { margin-left: 5px;font-weight: bold;}

HTML:

			<!-- Rounded Title -->			<p class="b1"></p>			<p class="b2"></p>			<p class="b3"></p>			<p class="b4"></p>						<div class="contentb">						  <div>						  <span style="float: right; margin-right: 5px">Grazie, e congratulazioni!</span>						  						  Registrazione effettuata con successo!</div>						</div>			<p class="b4"></p>			<p class="b3"></p>			<p class="b2"></p>			<p class="b1"></p>			<!-- / Rounded Title -->

I would like to call *all those tags and classes* (b4, b3, b2, b1) with one tag. Is there a way? I mean. I put:<div class="rounded_title">My title content</div>And I get the same... then it calls all the others tags and classes. Do you think is this possible?

Link to comment
Share on other sites

That is absolutely possible, however, not with that very CSS attached to it. (or maybe, if you put too much efford in it :) )It would be much easier if you just print screen the result of this code and save the round effects in a PNG format. Then use that as a background image :)

Link to comment
Share on other sites

Not with today's browsers unfortunatly, no. The best you can do is apply a single background image, and fix the text in a way that would never exceed outside of the image. But that very bad for accessability in that people with low eye sight will find it hard to read the box unless the text is already very big.

Link to comment
Share on other sites

If you are asking if it is possible to put:

<div class="rounded_title">My title content</div>

And then have something happen that makes the browser see:

<div class="rounded_title">	<p class="b1"></p>	<p class="b2"></p>	<p class="b3"></p>	<p class="b4"></p>		<div class="contentb">My title content		</div>	<p class="b4"></p>	<p class="b3"></p>	<p class="b2"></p>	<p class="b1"></p></div>

Then the answer is yes, but it'll require javascript and the DOM. Check out this page of the XML DOM for a little guidance if you want:http://www.w3schools.com/dom/dom_nodes_create.aspBasically, on page load, you'd get all the divs on the page, loop through them to see if they have a class name of "rounded_title". If a div has that class, take all the innerHTML and store that to a variable. Then use the DOM to create your "p" elements and the internal "contentb" div and append those elements to your div and the innerHTML to that new "contentb" div.Of course, this will only work for folks who have javascript enabled.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...