?
Solved

HTML table

Posted on 2016-09-15
7
Medium Priority
?
79 Views
Last Modified: 2016-10-16
Rigt now this table is alight to left. I want to add a very thin border to the table and indent the table just a bit to the right, 10px. How can I do this?  I don't want to use css - margin

<table>       
            <tr>
                <td colspan="2" valign="top">
                  lableOrder
                  textboxOrder
                <td>
            <tr>
            <tr>
                <td colspan="2" valign="top">
                  lableAddress
                  textboxAddress
                <td>
            <tr>
	     <tr>
                <td colspan="2" valign="top">
                  lableCountry
                  textboxCountry
                <td>
            <tr>
		<tr>
                <td valign="top">
                  lableItemNumber
                  textboxItemNumber
                <td>
		<td valign="top">
                  lablePrice
                  textboxPrice
                <td>
            <tr>	
 <table>

Open in new window

0
Comment
Question by:jagr12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 28

Accepted Solution

by:
Dr. Klahn earned 2000 total points
ID: 41800777
You could try putting the original table inside another table:

<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD>&nbsp;</TD>
<TD>original table goes here</TD>
</TR>
</TABLE>

Open in new window


The non-breaking space in the first column will give approximately 10 pixels width.  If precise width is required, a 10 pixel blank image can be inserted, or use another method to space exactly.
0
 
LVL 33

Expert Comment

by:Paul Sauvé
ID: 41800778
here is everything you wanted to know about table borders & margins and were too afraid to ask: Examples of table borders and rules - W3C

but margin seems to be the only way to go to add space on the outer edges of a table :-(
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 41800865
You could also wrap your table in a div with a left padding.

But I'm curious why you don't want to use margins which would be the obvious choice.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:funwithdotnet
ID: 41800893
Here's how I'd do it:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Table Sample</title>
</head>

<body>
<table cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <td><img src="spacerx.gif" width="10" height="10" alt=""/></td>
      <td>
      <table cellspacing="0" cellpadding="1" style="background-color: #000000;" >
  <tbody>
    <tr>
      <td><table width="200" cellspacing="1" cellpadding="1" style="background-color: #FFFFFF;">
  <tbody>
    <tr>
      <td>My</td>
      <td>Original</td>
      <td>Table</td>
    </tr>
    <tr>
      <td>My</td>
      <td>Original</td>
      <td>Table</td>
    </tr>
    <tr>
      <td>My</td>
      <td>Original</td>
      <td>Table</td>
    </tr>
  </tbody>
</table>
</td>
    </tr>
  </tbody>
</table>
</td>
    </tr>
  </tbody>
</table>
</body>
</html>

Open in new window

spacerx.gif
0
 
LVL 3

Expert Comment

by:pradeep kumar
ID: 41800942
Hi,

You can try to add 1 more table above current table and add 2 column and 1st <td> will have space how much you want and 2nd <td> have content.

Something like below example:
<table>
<tr>
 <td width="10"></td>
  <td>
    <table class='tablebox'>       
            <tr>
          
                <td colspan="2" valign="top">
                  lableOrder
                  textboxOrder
                <td>
            <tr>
            <tr>
      
                <td colspan="2" valign="top">
                  lableAddress
                  textboxAddress
                <td>
            <tr>
           <tr>

                <td colspan="2" valign="top">
                  lableCountry
                  textboxCountry
                <td>
            <tr>
            <tr>

                <td valign="top">
                  lableItemNumber
                  textboxItemNumber
                <td>
            <td valign="top">
                  lablePrice
                  textboxPrice
                <td>
            <tr>      
 </table>

  </td>
 </tr>
</table>

Open in new window


thanks
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 41801166
Why don't you want to use a margin?
Alternative wrap it in a div with padding
<div style="padding-left: 10px">
  <table>
   ...
   </table>
</div>

Open in new window

Or use a class
CSS
.padded-table {
   padding-left: 10px;
}

Open in new window

HTML
<div class="padded-table">
  <table>
   ...
   </table>
</div>

Open in new window

0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question