views:

49

answers:

3

Is it possible to have a div tag that has 1px black borders and a transparent background, so only the borders are showing? is this possible? Any examples?

A really appreciate it.

Erik

+2  A: 

It's absolutely possible.

#someDiv { border:1px solid #000; }

<div id="someDiv">The div must either have some content, or else have the height and width specified in the CSS above.</div>
stevelove
+2  A: 

The CSS:

div.emptybox {
  border: 1px solid black;
  background: transparent;
}

The HTML:

<div class="emptybox">
Hello World
</div>
Ben Lee
transparent background is the default, but the above makes it explicit
Ben Lee
A: 

Of course it is. <div> is transparent by default.

<style type="text/css">
.hw { border: 1px solid black; }
</style>

<div class="hw">Hello World</div>
Saul