?
Solved

Align=right dosent work ?

Posted on 2014-01-07
4
Medium Priority
?
414 Views
Last Modified: 2014-01-08
Hei!

Have this code for a header:

<header>
<table width="100%" align="left" border="1" padding-right="10px" class="headertabell">
<tr class="rapport1_del5">

<td class="rapport1_del5" align="left">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a></td>
<td class="rapport1_del5" align="left">
<a href="MPDF/examples/PDF6.php?brukerID=<?php echo $brukerID ?>&kundeid=<?php echo $kundeid ?>" target="_self"><img src="../images/PDF.png" align="left"/> PDF </a></td>
<td class="rapport1_del5" align="right">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Logg ut </a></td>
</tr>
</table>

</header >

Open in new window


***** CSS ********
.rapport1_del5
{
    background-color: #efefef;
    border: none ! important;
    box-shadow: none ! important;
    padding-left:15px;
      height:30px;
      padding-top:3px;
}


My problem is this code:
<td class="rapport1_del5" align="right">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button"

It dosent align="right", but it align="left"  WHY ?
0
Comment
Question by:team2005
[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
4 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 39761579
You have three different definitions:

<tr class="rapport1_del5">

<td class="rapport1_del5" align="left">

<td class="rapport1_del5" align="right">

Open in new window


as well as:

***** CSS ********
.rapport1_del5
{
    background-color: #efefef;
    border: none ! important;
    box-shadow: none ! important;
    padding-left:15px;
      height:30px;
      padding-top:3px;
}

Open in new window


I think the padding-left in the css is trumping your left vs right vs your blank align calls..
0
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 1000 total points
ID: 39761584
Use float: right on the elements, you'll have much more controls over what you want
Here's a test link: http://jsfiddle.net/AlexCode/8avHe/

And here's the changed code:
<header>
    <table width="100%" align="left" border="1" padding-right="10px" class="headertabell">
        <tr class="rapport1_del5">
            <td class="rapport1_del5" align="left">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a>
            </td>
            <td class="rapport1_del5" align="left">
<a href="MPDF/examples/PDF6.php?brukerID=<?php echo $brukerID ?>&kundeid=<?php echo $kundeid ?>" target="_self"><img src="../images/PDF.png" align="left"/> PDF </a>
            </td>
            <td class="rapport1_del5" align="right">
                <a href="#" onClick="window.print()"> 
                    <span style="float:right">Log out</span>
                    <img src="../images/skriver.png" TYPE="button" style="float:right" />
                </a>
            </td>
        </tr>
    </table>
</header>

Open in new window


Note that I only changed the part you mentioned and put the style inline.
It's better that you rework this layout a bit and move all styles to the css.
0
 
LVL 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1000 total points
ID: 39761688
Yes, avoid your inline styles  http://jsbin.com/ATUVuKIN/1/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style>
    table.headertabell{
  float:left;
  width:100%;
  padding-right:10px;
  border-style:solid;
  border-width:1px;
  
  
}
.leftText{text-align:left;}
.rightText{text-align:right;}
  </style>
</head>
<body>
  <header>
<table class="headertabell">
<tr class="rapport1_del5">

<td class="rapport1_del5 leftText">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a></td>
<td class="rapport1_del5 leftText">
<a href="MPDF/examples/PDF6.php?brukerID=<?php echo $brukerID ?>&kundeid=<?php echo $kundeid ?>" target="_self"><img src="../images/PDF.png" align="left"/> PDF </a></td>
<td class="rapport1_del5 rightText" >
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Logg ut </a></td>
</tr>
</table>

</header >
</body>
</html>

Open in new window


I would also consider making 3 div's instead of the table. http://jsbin.com/ATUVuKIN/2/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style>
    header{
      width:100%;
      border-style:solid;
      border-width:1px;
      height:50px;
    }
  .rapport1_del5{
  float:left;
  width:30%;
  margin-right:1%;

}
.leftText{text-align:left;}
.rightText{text-align:right;}
  </style>
</head>
<body>
  <header>

<div class="rapport1_del5 leftText">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a></div>
<div class="rapport1_del5 leftText">
<a href="MPDF/examples/PDF6.php?brukerID=<?php echo $brukerID ?>&kundeid=<?php echo $kundeid ?>" target="_self"><img src="../images/PDF.png" align="left"/> PDF </a></div>
<div class="rapport1_del5 rightText" >
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Logg ut </a></div>

</header >
</body>
</html>

Open in new window

0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39764622
Thanks
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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