Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A rectangle with borders

    Hello,

    I am using following code to form a rectangule with borders of width=2px. However, the top border looks much thicker than the bottom one. Do you know why and any suggestions?

    Thank you in advance.

    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td style="height: 2px; background-color: #cc9988" colspan="3"></td></tr>
    <tr>
    <td style="width: 2px; background-color: #cc9988"></td>
    <td>2222</td><td style="width: 2px; background-color: #cc9988"></td>
    </tr>
    <tr><td style="height: 2px; background-color: #cc9988" colspan="3"></td></tr>
    </table>
    Last edited by easter; 02-24-2013 at 05:28 PM. Reason: Forgot to insert the code

  • #2
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td style="height: 2px; background-color: #cc9988" colspan="3"></td></tr>
    <tr>
    <td style="width: 2px; background-color: #cc9988"></td>
    <td>2222</td><td style="width: 2px; background-color: #cc9988"></td>
    </tr>
    <tr><td style="height: 2px; background-color: #cc9988" colspan="3"></td></tr>
    </table>

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    Wow, from which year are you? 1995?

    Nowadays a rectangle is made like this:
    Code:
    <div class="example">content</div>
    and
    Code:
    .example {border: 2px solid #C98;}
    in an external stylesheet.
    (#C98 is the short form of #CC9988)

  • #4
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you!
    I need <table><tr><td>....to hold strings, pictures and want a rectangle frame around those stuff, such as "2222" in the above.

  • #5
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And I don't like the border in the <table

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,668
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello easter,
    Here is what VIPStephan means when he asks if you are from 1995 - http://www.hotdesign.com/seybold/

    There are much better ways of building websites now. As VIP has shown you, start with a div element as a container and you can put your pictures and 2222 in that.

    Put VIPStephan's example in a properly laid out .html document like this -
    Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <style type="text/css">
    	#example {border: 2px solid #c98;}
    </style>
    </head>
    <body>
    	<div id="example">
    		content
    	<!--end example--></div>
    </body>
    </html>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #7
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That looks so nice..... Can you translate following old code for me so that I can decide to change all my pages or not?
    <html>
    <head>
    </head>
    <body>
    <table border="1">
    <tr><td colspan="3">content</td></tr>
    <tr><td>content</td><td>content</td><td>content</td></tr>
    </table>
    </body>
    </html>

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    Well, divisions work a little different than a table in regards to sizing but using a fixed width this would be one way:
    Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>…</title>
    <link href="styles.css" rel="stylesheet" media="screen">
    </head>
    <body>
      <div id="container">
        <div id="header">top row</div>
        <div id="content">
          <div id="section1">content1</div>
          <div id="section2">content2</div>
          <div id="section3">content3</div>
        </div>
      </div>
    </body>
    </html>
    You see the <link> element there in the head? That links to a stylesheet in a separate CSS file which should have this content:
    Code:
    #container {
      border: 1px solid black;
      width: 300px; /* adjust as necessary */
      overflow: hidden;
    }
    #header {border-bottom: 1px solid black;}
    #content > div {
      float: left;
      width: 99px;
      border-left: 1px solid black;
    }
    #content > div:first-child {border-left: none;}
    That’s just one way to do it.

  • #9
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is a great help, I an going to study your code.
    Thanks a lot for all your helps!

  • #10
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As you said I am from 1995.... I hope there are something combines Table and Border style something like

    <head>
    <style type="text/css">
    #myBorder {border: 2px solid #c98;}
    </style>
    </head>

    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td>
    <div id="myBorder">
    content</div>
    </td></tr>
    <tr><td>
    <div id="myBorder">
    content</div>
    </td></tr>
    </table>

    The problem is the double border between two <tr>.....

  • #11
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This seems works:

    <head>
    <style type="text/css">
    #myBorder1234 {border-style: solid; border-width: 2px; border-color: #c98;}
    #myBorder234 {border-style: none solid solid solid; border-width: 2px; border-color: #c98;}
    #myBorder23 {border-style: none solid solid none; border-width: 2px; border-color: #c98;}
    </style>
    </head>

    <body>
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td colspan="2"><div id="myBorder1234">content</div></td></tr>
    <tr><td><div id="myBorder234">content</div></td><td><div id="myBorder23">content</div></td></tr></tr>
    </table>
    </body>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •