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 6573611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:09:20+00:00 2026-05-25T15:09:20+00:00

Im writing something in xhtml and I want my description elements and header elements

  • 0

Im writing something in xhtml and I want my description elements and header elements to be position along to the left of my image I used div elements instead of span but that breaks the rules of xhtml so i tried the span elements instead also but i can’t position them or add padding or margins to them what can i do. hee is what my code is. I want my description and header elements exaclty in the vertically in the middle beside the image about 5 pixels from the left

<div class="menu" style="width:300px; height:300px">
    <ul>
        <li class="menu-item">
            <a href="#">
                <img alt="" src="images/Icon.jpg" width="36" height="36" style="float:left; border:1px solid #000000" />
                <div class="header">Electronics</div> // << span here doesn't work
                <div class="description">Computers & Office Supplies</div> // << span here doesn't work
            </a>
        </li>
    </ul>
</div>

breaks the xhtml rules what do I do

  • 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-25T15:09:21+00:00Added an answer on May 25, 2026 at 3:09 pm

    This way they are on the same line, horizontally (even thought you said vertically, but I think you mixed them up..since your current code would be displaying them vertically):

    <div class="menu" style="width: 300px; height: 300px">
        <ul>
            <li class="menu-item">
                <a href="#">
                    <img alt="There should be an alt text here" src="images/Icon.jpg" style="float: left; border: 1px solid #000000; width: 36px; height: 36px;" />
                    <span style="float: left; display: block;" class="header">Electronics</span>
                    <span style="float: left; display: block;" class="description">Computers & Office Supplies</span>
                </a>
            </li>
        </ul>
    </div>
    

    However, I cant really understand, why your xhtml is not validating correctly, with div’s?! I think you meant, that your layout was breaking up.. because div = display: block;. To dumb it down, it means, that it will be full width..and doesn’t really care about anyone else — divs are selfish.

    So in that case you need either to float it some way.. that makes it less selfish. Or make it display: inline-block;. However, inline-block is not very cross-browser.. so I recommend to use floating.

    • http://www.w3schools.com/css/css_float.asp
    • http://www.w3schools.com/cssref/pr_class_display.asp
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im writing something similar to a coupon code function, and want to be able
I'm writing something in prolog and the way I used append, it ends up
I'm writing a web service, and I want to return the data as XHTML.
I really dont like writing something like $('body').append('<div class=foo>foo</div>'); Because i usually end up
I'm writing something in C++. I have 2 classes which I want to contain
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
I am writing something that will allow users to search through a log of
Heys, I am writing something in Xcode. I use Core Data for persistency and
How do I escape the underscore character? I am writing something like the following
That is to say, let's say I'm writing something that's hosted on foo.com .

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.