?
Solved

How do I align picture on left and right next to it text in html using div

Posted on 2013-12-08
3
Medium Priority
?
620 Views
Last Modified: 2013-12-10
I want to acheive like this in html using div or any good format. I cannot use css because it is a knockou js script file.

Image    Text1
              Text2
              Text3

The text will be exactly on the right of the image but not below the image. I tried this code but it is putting my text below the image

MY CODE

<table>

            <tbody data-bind='foreach: $root.materials.Rows'>
            
                  
                  
                  <div style="float:left;width:158px;text-align:left;">
                  <img width="56px" height="56px" data-bind="attr : {src: Picture().Url}" /></div>
            <div style="float:right;width:158px;text-align:right;">
                        
                        <p>      <a data-bind="attr: { href:'/material/Lists/pictures/DispForm.aspx?ID=' + ID()}, text:Title"></a></p>
            </div>
<div style="float:left;width:180px;text-align:left; ">
                              <span data-bind='text: Specialities_Title'></span>
      </div>
                        
                  <div style="float:left;width:180px;text-align:left; ">
                        
                              <span data-bind='text: Degree'></span>
                        </div>                        
                        <div style="float:left;width:180px;text-align:left; ">
                              <span data-bind='text: Street'></span>
                        </div>                        
                        <div style="float:left;width:180px;text-align:left; ">
                              <span data-bind='text: City'></span>&nbsp<span data-bind='text: State'>&nbsp</span><span data-bind='text: Zip'></span>
                        </div>                  
                  <div style="float:left;width:180px;text-align:left;">
                              <span data-bind='text: Phone'></span>
                                
                  </div>
                  
            </tbody>
      
      </table>
0
Comment
Question by:bujjigadu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
duttcom earned 620 total points
ID: 39705412
You probably don't need the table and you have way too many divs there. Try something like this where there are only two divs - one with float:left to hold the image and the other one without float (and a fixed size) which will just sit next to the first div. You can add paragraph tags or other formatting to the spans within the second div -

<div style="float:left;width:158px;text-align:left;">
<img width="56px" height="56px" data-bind="attr : {src: Picture().Url}" />
</div>
<div style="width:158px;">

<a data-bind="attr: { href:'/material/Lists/pictures/DispForm.aspx?ID=' + ID()}, text:Title"></a>

<span data-bind='text: Specialities_Title'></span>

<span data-bind='text: Degree'></span>

<span data-bind='text: Street'></span>

<span data-bind='text: City'></span>&nbsp<span data-bind='text: State'>&nbsp</span><span data-bind='text: Zip'></span>
                       
 <span data-bind='text: Phone'></span>
                               
                  </div>
0
 

Author Comment

by:bujjigadu
ID: 39706261
It doesn't work. Still put the text under picture
0
 

Author Closing Comment

by:bujjigadu
ID: 39710088
not exact answer
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 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