Click here to Skip to main content
15,892,797 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am trying to align a logo parallel to the text, but my code is not working properly.

HTML
<section class="section">
    <div class="container">
        <div class="row">
            <div class="col-xs-6">
  
                    <p>Where some see a Wastewater Treatment Plant, Huber Technology envisions a Resource Recovery Center.</p>
            <div class="col-xs-6">
                 <img src="http://www.huber-technology.com/fileadmin/huber-template2013/www/img/logo-huber_hd.png">
              </div> 
              </div>
            </div>
          </div>
        </div>
    </section>


Can anyone point me in the right direction to align these items parallel to each other?
Posted
Comments
Sergey Alexandrovich Kryukov 27-Jul-15 16:06pm    
How anything can be "not parallel"? Did you turn anything? No, you did not. Rather, you have to explain what do you mean.
—SA

1 solution

Even in ab HTML web site, you need to provide enough space for the elements to be able to fit in. Otherwise, they will continue to stack themselves from top to bottom. In your case, the problem is similar (as per default CSS; you have not shown any CSS code).

I have tried a similar case as you are having. I added some CSS properties to change the width of elements, set them to a value that can hold both of the child element. Then finally, set them to display inline.

HTML
<!-- Sample HTML code; that ressembles your case -->
<div class="container">
    <p>Where some see a Wastewater Treatment Plant, Huber Technology envisions a Resource Recovery Center.</p>
    <div class="col-xs-6">
        <img src="https://www.google.com.pk/images/srpr/logo11w.png" />
    </div> 
</div>


To align the paragraph and the Google's logo in one place, I used the following CSS code,

CSS
// Container element should take 100% of space. 
.container {
    width: 100%;
}

// Display them in one line
.container p, .container div img {
    display: inline-block;
}

// Paragraph to left side
.container p {
    width: 60%;
    float: left;
}

// Image to the right
.container div img {
    width: 38%;
    float: right;
}
// You can change the floating positions to change the position of elements. 


The content was aligned in a line; because of their widths set to a percentage of their parent's and the display set to inline-block. You can test the above sample at, http://jsfiddle.net/afzaal_ahmad_zeeshan/2hu1dk3w/[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900