Jump to content

Vertical align text with image


cebsen

Recommended Posts

I'm having a challenge using CSS property vertical-align,  I want to use the latest CSS to get this done, not put the code within the HTML or putting the style under the head of the page.  The CSS code as follows

p.parrot img {
vertical-align: text-top;

}

HTML

<p.parrot img?<img src-"Images/redparrot.gif wisth="195" height="156">

I've uploaded the file so go to animalandhumannutrition101.com/ourstory.html to view it with the problem

 

Edited by cebsen
needed to add text
Link to comment
Share on other sites

Your HTML needs to be like this

<p class="parrot">
  <img src="Images/red_parrot_on_computer_lg_clr_6287.gif" width="195" height="156">
  My story begins with me ...
</p>

"p.parrot" selects any <p> element where the class attribute has "parrot" in it. "p.parrot img" selects an image which is inside that <p> element.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...