Solved

Align=right dosent work ?

Posted on 2014-01-07
4
405 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
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 250 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 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 250 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Set time on Session (ASP) 14 30
Validating Date 4 28
Why is my $_POST not going to results page 10 36
Table header must be on top 2 27
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

749 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