Data Recovery Forums - Help & Discussions Forum Index

Data Backup Software
Data Recovery Forums - Help & Discussions
Free online data recovery guide to help you find the information you need to recover your data. Discuss and get help about data recovery in this forum.
Data Recovery | RAID Recovery | Laptop Data Recovery

 FAQsFAQs   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Data Recovery Software
Aligning Images With CSS

 
Post new topic   Reply to topic    Data Recovery Forums - Help & Discussions Forum Index -> Styling & Designing


 
Author Message
Isabella



Joined: 15 Jun 2006
Posts: 100

PostPosted: Fri Aug 11, 2006 11:41 pm    Post subject: Aligning Images With CSS Reply with quote

The most obvious CSS solution is to use the text-align property to center the image. Unfortunately, that has the same effect as adding align="center" to the image tag: browsers ignore it entirely!

Instead, you'll have to apply the text-align property to the container element (the paragraph, DIV, or other block-level element that contains the image).

Create a style class and add it to the HEAD section of your page. Even better, add it to your external style sheet and use it on every page!

Code:
<style type="text/css">
  .centeredImage
    {
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    padding:0px;
    }
</style>



Then, apply the class to the container element:

Code:
<p class="centeredImage"><img src="imgName.gif" alt="image description" height="100" width="100"></p>


That's slightly more trouble than just applying align="center" to the paragraph tag, but it has the added benefit of giving you more control over the spacing around the image. Note that in our example, we set the margin and padding values to zero pixels to avoid extra spacing that may push important content farther down the page.

Smile

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Data Recovery Forums - Help & Discussions Forum Index -> Styling & Designing All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Data Recovery London UK | Data Recovery Software

Powered by phpBB © 2001, 2005 phpBB Group