Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

HTML problem

  • 15-11-2010 11:27am
    #1
    Closed Accounts Posts: 146 ✭✭


    Maybe somebody could help with this.

    I'm trying to create a basic page:
    an Image at the top
    Some text underneath
    Then a dropdown list under that

    The problem I have is the the dropdown list is aligning to the right of the image?

    [PHP]
    <html>
    <head>
    <title>Search Page</title>
    <style type="text/css">
    p{float:left}
    </style>
    </head>
    <body bgcolor="#EFF582" text="black">
    <img src="logo.png" alt="logo" height="136px" width="893px" border="0" />
    <br />
    <p>
    Some text here</p>
    <br /><br />
    <p>
    <form action="search.asp" method="post">
    Category:
    <select name="Category" >
    <option>cat01</option>
    <option>cat02</option>
    <option>cat03</option>
    </select>
    <input type="submit" value="Submit" />
    </form>
    </p>
    [/PHP]
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    It's because you're using float:left for p tags, I suppose.


  • Closed Accounts Posts: 146 ✭✭mid


    thanks, I got it working

    I think it was because I was missing the </img> tag


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    Hah, good stuff!


  • Registered Users, Registered Users 2 Posts: 1,771 ✭✭✭jebuz


    mid wrote: »
    thanks, I got it working

    I think it was because I was missing the </img> tag

    No you're not, you have the image tag correct.
    <img src="logo.png" alt="logo" height="136px" width="893px" border="0" />
    

    is the same as
    <img src="logo.png" alt="logo" height="136px" width="893px" border="0" ></img>
    

    Try get into the habit of using DIV's instead of paragraphs for laying out your pages, they render vertically down the page (unless using floats), so here is how you could use them in your code using 3 div's, one for the image, one for the text below that and then another for the dropdown.
    <html>
      <head>
        <title>Search Page</title>
        <style type="text/css">
        p {float:left}
        </style>
      </head>
    
      <body bgcolor="#EFF582" text="black">
        <div>
          <img src="logo.png" alt="logo" height="136px" width="893px" border="0" />
        </div>
    
        <div>Some text here</div>
        <div>
          <form action="search.asp" method="post">
            Category:
            <select name="Category" >
             <option>cat01</option>
             <option>cat02</option>
             <option>cat03</option>
            </select>
            <input type="submit" value="Submit" />
          </form>
        </div> 
      </body>
    </html>
    


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    jebuz wrote: »
    Try get into the habit of using DIV's instead of paragraphs for laying out your pages, they render vertically down the page (unless using floats), so here is how you could use them in your code using 3 div's, one for the image, one for the text below that and then another for the dropdown.
    <html>
      <head>
        <title>Search Page</title>
        <style type="text/css">
        p {float:left}
        </style>
      </head>
    
      <body bgcolor="#EFF582" text="black">
        <div>
          <img src="logo.png" alt="logo" height="136px" width="893px" border="0" />
        </div>
    
        <div>Some text here</div>
        <div>
          <form action="search.asp" method="post">
            Category:
            <select name="Category" >
             <option>cat01</option>
             <option>cat02</option>
             <option>cat03</option>
            </select>
            <input type="submit" value="Submit" />
          </form>
        </div> 
      </body>
    </html>
    
    I disagree with "using DIV's instead of paragraphs for laying out your pages" - paragraphs will render vertically too (divs and paragraphs are both block elements).

    Using a lot of unnecessary divs brings on a case of Divitius.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,771 ✭✭✭jebuz


    That page pretty much echoes what I said, as in using divs for defining sections of the page, paragraphs should be used for blocks text. I didn't recommend using div's for headings or blocks of text, that I agree is unnecessary.

    In the code above, I can't see the advantage of using paragraphs instead of div's, except for possibly the "some text here" part, but that could easily be a heading. I certainly wouldn't go around replacing divs with paragraphs just to avoid "divitus", you're simply encouraging p-itus ;)


Advertisement