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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:15:14+00:00 2026-06-15T21:15:14+00:00

I am learning to style photos with css. I centered a photo, but when

  • 0

I am learning to style photos with css. I centered a photo, but when I resized it by halving its original dimensions, the left and right borders do not wrap around the image. The top and bottom of the border are correct.

I have not found any tutorials or responses for similar issues and I would appreciate your thoughts on resolving this issue.

.img {
         text-align:center;
         margin-top:80px;
         margin-bottom:0px;
         padding:0px;
         border:4px solid #F2F2F2;
         }

The example website is at http://nspowers.org.
A link to the full stylesheet used is http://nspowers.org/stylesheet/stylesimgquestion.css and the image properties are at the very bottom.

Thank you

  • 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-06-15T21:15:15+00:00Added an answer on June 15, 2026 at 9:15 pm

    You’re not styling the image itself rather the container div that has the image inside. If you change the selector of your CSS from .img which targets elements with the class img to img (note the missing dot) you will target all images.

    Or if you want to be more specific, you could add it to all images with a certain class by calling img.myClass which will target all images that have the class myClass.

    Although I’d advice you not to use .img as a class name since it can be confusing.

    Update

    Here’s a full example of the code, without all the clutter from other classes and elements.
    You can view a live demo in this fiddle

    HTML

    <div class='centered'>
    <img src='http://nspowers.org/excomm_photo.jpg' height="251" width="380"/>
    </div>​
    

    CSS

    .centered{
        text-align:center;
    }
    
    .centered img{
        border:5px solid blue;
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning css & jquery. <!DOCTYPE html> <html> <head> <style type=text/css> #box
I am learning java ee right now. I have successfully implemented a hello-world style
I'm learning CSS and HTML. In my code I have: <style> table, td, th
<html> <head> <title> Learning CSS </title> <style type=text/css> #header { padding:1px; margin:1px; border:1px solid
I'm learning C++. For me, my programming style is just what looks the best;
I'm learning Jsoup and have this HTML: [...] <p style=...> <!-- div 1 -->
I am learning to use styles in wpf and I am creating a style
I'm learning javascript and one of my exercises was to move box from left
I am learning HTML/CSS, and so far, I still have difficulties with CSS, especially
I am learning HTML and CSS, and I want to create a fixed-width page

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.