How to create a "box" around text blocks on Wordpress?

PatPirate

New member
Dec 27, 2009
320
2
0
Hi,

you know these little boxes in yellow and / or with red dashed lines around discount links and other text you want to highlight? I need this for my wordpress blog. Could somebody explain me how?
 


You'd accomplish that with CSS. Something like this should work..

h1 {
display:block;
padding:5px;
border:4px dashed #colorcodehere;
}

"h1" being whichever html element you want to highlight (or ID or class). Can't guarantee the above'll work, but try it out and experiment.

edit oops.. changed "solid" to "dashed".
 
Hey,

I tried it with red as color code, so now my CSS looks like this:
Code:
/*
Theme Name: {and loads of other stuff nobody cares about ;) }
*/

h15 {
display:block;
padding:5px;
border:4px dashed #FF0000;
}


@import url("css/all.css");
Doesn't seem to work though, when adding something with <h15> and </h15> in HTML mode, it is simply removed after updating the page, so something must be wrong.

Any ideas?
 
OK now I got it to work (replaced h15 with h5), problem is now of course I have to use h5 to create the box while most stuff I want "boxed" are simply bold.
 
use the html sidebar widget (forget what its called) you can put whatever html you want in there e.g
Code:
<div id="offerbox">Offer text here</div>
then just create a style called #offerbox or whatever you called it..
Code:
#offerbox { display:block; padding:5px; border:4px dashed #FF0000; }
 
  • Like
Reactions: PatPirate
Hey butcher,

that is not quite how I want it to be... It is more like in the text, directly under the page title saying "warning, there is a special deal but you have to act quickly... yadayada", not some sidebar to the right on the page.

What dreamache proposed worked quite well, if only you could use it without the header tags.
 
You can use it without header tags, it's the markup that counts.


You dont need it to be in the sidebar to do what the above poster said either. You can make up any name an assign it to a div like he showed. I'm not sure why he even mentioned the sidebar part.
And yes that's probably not something I use with H tags either.


If you want pm me the site and Ill take a look at the code.