Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a thin horizontal (hair)line?

Status
Not open for further replies.

kippie

Technical User
Nov 8, 2001
158
The command <hr> makes a horizontal line. Is there a command to make this line thinner? Or should I do it in another way>

Kippie

 
use css:

<hr style=&quot;height:1px;border:1px solid black;&quot;/>
=========================================================
if (!succeed) try();
-jeff
 
Hi,

I am trying to get a CSS Hr tag to work in netscape. Does netscape support this style. It works in IE.
 
this should fix it:

<hr style=&quot;height:1px;border-width:1px 0px 0px 0px;&quot;/>
=========================================================
if (!succeed) try();
-jeff
 
Remember that you also have the option of using a 1 pixel gif for horizontal or vertical lines...

<img src=&quot;pix.gif&quot; width=800 height=1>

Just make a one pixel gif from any image editing program in whatever color you desire.... Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
mikewolf@tst-us.com (Do not email regarding this thread unless requested - I don't check this account regularly)
 
Hi Kippie,

There's a way to do this without using external files, although it requires that you do a bit of bookkeeping...

Take a look at this:

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>JavaScript Sample</title>
  </head>
  <body>
    <p>A table below, with borders aplenty, but no graphic images</p>
    <table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
      <tr>
        <td colspan=&quot;11&quot; height=&quot;1&quot; bgcolor=&quot;#000000&quot;></td>
      </tr>
      <tr>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
        <td width=&quot;3&quot;></td>
        <td>a1</td>
        <td width=&quot;3&quot;></td>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
        <td width=&quot;3&quot;></td>
        <td>c1</td>
        <td>d1</td>
        <td>e1</td>
        <td width=&quot;3&quot;></td>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
      </tr>
      <tr>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
        <td width=&quot;3&quot;></td>
        <td>a2 </td>
        <td width=&quot;3&quot;></td>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
        <td width=&quot;3&quot;></td>
        <td> c2</td>
        <td>d2</td>
        <td>e2</td>
        <td width=&quot;3&quot;></td>
        <td bgcolor=&quot;#000000&quot; width=&quot;1&quot;></td>
      </tr>
      <tr>
        <td colspan=&quot;11&quot; height=&quot;1&quot; bgcolor=&quot;#000000&quot;></td>
      </tr>
    </table>
  </body>
</html>

Hairline horizontal AND vertical bars, plus you can make 'em any RGB color you prefer. I just picked black to impress goth chicks.

Good luck!
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Thanks, Ian.

Kippie, making a horizontal line is, of course, just a matter of making a 1-row, 1-column table with a td color of whatever you like and a height of whatever you like. You can even do multiple rows if you want to do something fancy such as thick-thin-thick lines, simulating drop-shadow, etc.

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Hi Guys,

This site is new to me but everyone has been great at replying to my problems. But I am still having a headache with CSS.

I have put this piece of code in an external CSS file
hr { color: FFCC33; }. I just want the Hr to be yellow in netscape (it does it IE). What am I doing wrong?
 
no - &quot;color&quot; is for text color. use &quot;background-color&quot; instead

Edward - nice example with the tables, but can't you do the same thing with half the code using CSS?

[tt]<table align=&quot;center&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;>
<tr>
<td style=&quot;border:2px solid red;&quot;>a1</td>
<td style=&quot;border:2px solid green;&quot;>b1</td>
</tr>
<tr>
<td style=&quot;border:2px solid blue;&quot;>a2</td>
<td style=&quot;border:2px solid cyan;&quot;>b2</td>
</tr>
</table>
[/tt]
=========================================================
if (!succeed) try();
-jeff
 
From what I remember, netScape is not very receptive to css on HRs. I think you might be stuck with black unless you use one of the other suggestions above. Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
mikewolf@tst-us.com (Do not email regarding this thread unless requested - I don't check this account regularly)
 
jemminger,

Actually, you can use even less if you spec it in an external stylesheet:

Code:
<table align=&quot;center&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;>
    <tr>
        <td class=&quot;Rdot&quot;a1</td>
        <td class=&quot;GDot&quot;>b1</td>
    </tr>
    <tr>
        <td class=&quot;BDot&quot;>a2</td>
        <td class=&quot;CDot&quot;>b2</td>
    </tr>
</table>

Plus you get to keep using those classes again in the same document, plus you can use them in other documents. Can't do that using font-- er &quot;inline styles&quot;.

I guess I tend to think of using CSS in external stylesheets or not at all (so my example avoided all style calls, which is a distinction I mentioned).

I'm a total fan of external files, external CSS, external JS, external anything-I-can-make-external. Centralized software is for Redmond startups... [smile]

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Edward,
i agree - i use .css and .js includes for 99% of my work too - just makes for quicker examples here to use inline :) =========================================================
if (!succeed) try();
-jeff
 
Hiya,

God sorry I am only replying now. I haven't been on this site in a while. If you type in size=1 within the <hr> tag this will make the line thinner.
 
Another technique I often use for very thin lines (however produced) is to make them light/mid grey rather than black. Keep the lines solid however: dotted effects can become very messy.

Linnet

 
I like the table approach because it can make nice boxes, but for most uses the old hr tag is the way to go.

jeff, your sig &quot;if (!succeed) try();&quot; perhaps should be &quot;while (!succeed) try();&quot; That way any fail will work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top