Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:31:39+00:00 2026-05-13T11:31:39+00:00

I am trying to align an image and some text together. If you refer

  • 0

I am trying to align an image and some text together. If you refer the below code there will be and image and some text( Name and Age) I want both of them to be next to each other. I did try float: left but still no luck.

Thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
        <title></title>
    <style>
        img {
            height: 10px;
            width: 20px;

        }
        ul li{


            display:block;
        }
        ul {
            margin: 0;
            float: left;
        }
        #container {
            margin: 10px

        }
    </style>

    </head>
    <body>
    <div id="container">
    <p>
    <img src="cat.jpg"> <ul><li>Source</li><li>Item Link Title</li> </ul> </p>
    </div>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:31:40+00:00Added an answer on May 13, 2026 at 11:31 am

    Technically your HTML is invalid. A list is a block level element and you can’t (or shouldn’t) embed then in paragraphs since they should only take inline elements.

    There is no Name and Age mentioned anywhere in your markup so I’m not sure what you’re referring to there.

    Edit: to put the image on the left and have the two labels on the right one above the other, use this markup:

    <div id="container">
    <img src="cat.jpg">
    <ul>
      <li>Source</li>
      <li>Item Link Title</li>
    </ul>
    </div>
    

    and either this CSS:

    html, body, div, ul, li, img { padding: 0; margin: 0; border: 0 none; }
    #container { background: yellow; overflow: hidden; float: left; }
    #container img { float: left; }
    #container ul { list-style-type: none; float: left; background: green; }
    

    The float: left on the container is optional. It simply means that it isn’t as wide as its container. The first line is a crude reset CSS. I’d suggest using a real CSS and a DOCTYPE always.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to vertically align to the middle both an image and some
I am trying to include an image and some text inside a button element.
I am trying to place some text over a button image. I manage to
I am trying to put some HTML text over an image that has been
I am trying to write some JSF code that centers an image in a
I'm trying to vertically center some text besides two image links. I've done this
I am trying to vertically center an image and text. Here is the code
I'm trying to do some jQuery which will find images inside text, wrap the
I'm using SWT in Java and I'm trying to left align an image and
I have been trying to align an entire label along with text to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.