SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    strange <hr /> echoing

    Hi. I'm having a strande problem with <hr /> - it is displayed in the same line where my image is. I tried <br /> <table> and few other tags, but it didn't work like thought. Here's my code:

    PHP Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Vīni</title>
    <style type="text/css">
    .container {
        font-family:verdana,arial,helvetica,sans-serif;
        font-size:16px;
    }
    a.info {
        position:relative;
        z-index:0;
        color:#808080;
        font-style:oblique;
        text-decoration:none;  
        display:block;
        float:left;
    }
    a.info .ttip {
        display: none;
        float:left;
    }
    a.info:hover{
        z-index:1;
        background-color:#808080;
    }
    a.info:hover .ttip {  
        display:block;
        position:absolute;
        top:20px;
        left:40px;
        width:120px;
        border:3px double #800000; /* loga raamja kraasa */
        background-color:#808080; /* loga aizmugureejais fons */
        color:#000000; /* burtu kraasa */
        font-size:10px;
        font-style:normal;
        padding:5px;
    }
    a.info:hover #pictip {
        top:20px;
        left:-280px;
        width:240px;
        border:3px double #800000;
        background-color:#808080;
        color:#000000;
        font-size:12px;
        text-align:justify;
        padding:10px;
    }
    </style>
    </head>
    <body background="images/body-bg.gif">
     
    <?
    $konekcija=mysql_connect('127.0.0.1','*','*') or die ("Datubāzei pieslēgties neizdevās");
    mysql_select_db('*',$konekcija);
     
    echo "<h1><center><u>Mana kolekcija</u></center></h1><hr color=\"#7d0415\" size=\"2\">";
     
     
    if(!isset($_GET['page'])){
        $page = 1;
    } else {
        $page = $_GET['page'];
    }
     
    $max_results = 10;
     
    $from = (($page * $max_results) - $max_results); 
     
    $vaicajums2 = "SELECT * FROM `sadalja` order by `id` desc LIMIT $from, $max_results";
    $rezultats=mysql_query($vaicajums2,$konekcija);
     
    while($row = mysql_fetch_array($rezultats)){
     
    echo '<div width="100%" class="container">';
    echo '<a href="#" class="info">';
    echo ''.$row['attels'].'<br />';
    echo '<span class="ttip">';
        echo '<b>Nosaukums:</b> '.$row['nosaukums'].' <br />';
        echo '<b>Komentārs:</b> '.$row['komentars'].' <br />';
    echo '</span></a></div>';
     
     
    }
    echo "<hr color=\"#7d0415\" size=\"2\">";
     
    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM `sadalja`"),0);
     
    $total_pages = ceil($total_results / $max_results);
     
    echo "<center>Izvēlaties lapu<br />";
     
     
    if($page > 1){
        $prev = ($page - 1);
        echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><< Atpakaļ</a> ";
    }
     
    for($i = 1; $i <= $total_pages; $i++){
        if(($page) == $i){
            echo "$i ";
            } else {
                echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
        }
    }
     
     
    if($page < $total_pages){
        $next = ($page + 1);
        echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Tālāk >></a>";
    }
    echo "</center>";
     
    ?>
    </body>
    </html>
    The code works almost perfectly, except showing the pagination and the <hr />, under the image not on one line with it. Here's an image to understand better my problem: http://img62.imageshack.us/img62/7001/attelsab9.png . Sorry about the long code, but I don't want to erase anything, because, maybe my mistake would be there.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    view the html source that your php script produces.

    echo the <hr> at a different position in your script.
    you also seem to have some invalid html. use an html validator to see.

  3. #3
    SitePoint Addict
    Join Date
    May 2006
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    view the html source that your php script produces.

    echo the <hr> at a different position in your script.
    you also seem to have some invalid html. use an html validator to see.
    my browser displays this code:

    HTML Code:
    <div width="100%" class="container">
    <a href="#" class="info">
    <img src="http://www.123.lv/myimages/123.JPG"><br>
    <span class="ttip"><b>Nosaukums:</b> Title <br>
    <b>Komentārs:</b> Text. <br></span></a></div>
    <hr color="#7d0415" size="2">
    So I don't see any mistake here or in html code, maybe the letter "ī" makes here the code display incorrect. btw I already tried moving <hr /> and as you can see from the code, I don't have much variations.

  4. #4
    SitePoint Addict pkSML's Avatar
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What browser are you using? I have noticed CSS quirks in Netscape, Firefox... Only IE has a perfect track record that I know of for displaying CSS.

    You certainly are seeing strange things! Have you tried separating the IMG tag from the HR tag by a simple <BR>?
    -Stephen

    Get a LitlURL to this page!

  5. #5
    SitePoint Addict
    Join Date
    May 2006
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    of course, and it also didn't work.

    edit: I just tried to add <br /> after <div> tag, and the <hr /> started moving down, but when I add another picture, it again takes the same possition as it was in the start of my thread.

  6. #6
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I noticed you have a left-floated span that is not cleared. Try:
    HTML Code:
    <hr style="clear:left;" color="#7d0415" size="2">

  7. #7
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    Quote Originally Posted by pkSML
    Only IE has a perfect track record that I know of for displaying CSS.
    Say WHAT?!

  8. #8
    SitePoint Addict
    Join Date
    May 2006
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mudshark
    I noticed you have a left-floated span that is not cleared. Try:
    HTML Code:
    <hr style="clear:left;" color="#7d0415" size="2">
    oh yes, I missed that part, really big thanks mudshark!!!


Bookmarks

Posting Permissions

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