skip to Main Content

I’m making an application using Dreamweaver for a school project, and have used a version of the code I found online and re-writing it to suit the assignment needs.

Problem I have my links as actual images created in Photoshop (which are working). These are on a .css file, each by their own separate li tag. (These don’t need to be changed!)

Eg.

li.accom {
    height:93px;
    width:556px;
    background-image:url(../images/accom.png);
}

Question

How do you center these images? I’ve tried text-align=centre; and that hasn’t worked.

2

Answers


  1. Try this https://jsfiddle.net/2Lzo9vfc/64/

    CSS

        li {
        width: 150px;
        height: 50px;
        margin: 10px;
        list-style-type: none;
        border: 1px solid black;
        text-align: center;
        background: url('http://placehold.it/70x50');
        background-repeat: no-repeat;
        background-position: center;
    }
    
    Login or Signup to reply.
  2. For backgrounds you have These CSS rules.

    For your image, you will need of background-position attribute with value: center and, if you don’t want it to be repeated, background-repeat attribute with value no-repeat.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search