Drawing a line from a point to another.

Discussion in 'HTML & Website Design' started by vendor1949, Aug 20, 2011.

  1. #1
    Will any DP member please explain how to draw a line from a point to another in HTML with the script? Because I have to draw a right angled triangle in my educational site.
     
    vendor1949, Aug 20, 2011 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    You can't. Except with HTML5's canvas element.
     
    drhowarddrfine, Aug 20, 2011 IP
  3. xira

    xira Active Member

    Messages:
    315
    Likes Received:
    8
    Best Answers:
    4
    Trophy Points:
    68
    #3
    drhowarddrfine is correct, and you'd still have to use Javascript within the canvas. Your other "cheating" alternative is to use a table (with CSS) or a <div> also with CSS and an image for the angled line. You set the <div> as a retangle with the height and length you need, and activate the borders for the bottom and side:
    .mytriangle{
    width: 100px;
    height: 100px;
    border-left: 1px solid #000;
    border-bottom: 1px solid #000;
    }

    Within the table cell or your div, you than place a picture with the connecting angled line. You might want to put it in the background:
    .mytriangle{
    background: url(http://... adress of the image here)left top repeat-none;
    }

    It's cheating, but it will work.
    good luck.
     
    xira, Aug 20, 2011 IP
  4. vendor1949

    vendor1949 Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I know canvas element but after that ????
     
    vendor1949, Aug 21, 2011 IP