Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Align=right dosent work ?

Posted on 2014-01-07
4
Medium Priority
?
424 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 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 54

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

810 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