Solved

Problem.s with aligning / displaying images

Posted on 2013-01-03
7
357 Views
Last Modified: 2013-01-04
Hi!

1) We have two images on this page and are trying to get them to be hortizontally aligned.
Currently, they are being displayed vertically aligned.
2) Also we can not scroll down the page to see more than half of this first image.
So we would greatly appreciate any specific code corrections in correcting these two issues.
Thank you ...


HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Home Page</title>
</head>

<body>
<div id="container">

<div id="banner">
<h1>Maui</h1>
</div>
<div id="nav">
<ul>
 <li><a href="index.htm">Home</a></li>
 <li><a href="bumper.htm">Bumper</a></li>
 <li><a href="clothes.htm">Clothes</a></li>
 <li><a href="flag.htm">Flag</a></li>
 <li><a href="shirt.htm">Shirt</a></li>
 <li><a href="holiday.htm">Holiday</a></li>
 <li><a href="money.htm">Money</a></li>
 </ul>
</div>

<div id="images">
<img class="display" border="0" src="kahekili maui chief.jpg" alt="" />
<img class="display" border="0" src="maui_map.jpg" alt="" />
</div>

</div>

</body>
</html>

CSS:

#container {
         width:960px;
      height:1000px;
      background-color:#FFFFFF;
      color:#000000;
}
#banner {
    position:fixed;
    top:0px;
    margin-left: auto;
      width:960px;
      height:100px;
      background-color:#81B0DA;
      color:#000000;
      border:#211D20 solid 10px;
    font-size:28px;
    text-align:center;
    padding-right:10px;
}
#nav {
    position:fixed;
    top:125px;
    margin-left: auto;
      width:990px;
      height:20px;
      background-color:#4E5B74;
      color:#6492C5;
}
#images {
    position:fixed;
    top:165px;
        border:#211D20 solid 10px;
        text-align:center;
}

.display {
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
    height: 960px;
}

#td {
      text-align:center;
}
ul {
    list-style-type:none;
    text-align:center;
    padding:0;
    overflow:hidden;
}
li {
    float:left;
}
a {
    display:block;
    width:141.4px;
    background-color:#D2D5B7;
    text-decoration:none;
}
h1 {
      color:#D2D5B7;
}
0
Comment
Question by:TrueBlue
  • 3
  • 2
  • 2
7 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 38742646
Look into changing your:

position:fixed

You should be using absolute - relative if you want to be able to scroll in the same div

Please look at this:
http://www.w3schools.com/css/css_positioning.asp
0
 

Author Comment

by:TrueBlue
ID: 38742681
becraig,

we changed all instances of position:fixed to position:absolute and now we can scroll, but the two images are still vertically aligned.
how can we make then horitizontally aligned?
they are each 320 pixels wide.
TIA
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 100 total points
ID: 38742694
change your display format from inline-block to inline for those two images

#images {

    display:inline;
    position:relative;
    top:165px;
        border:#211D20 solid 10px;
        text-align:center;
}
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 12

Expert Comment

by:Dean OBrien
ID: 38743487
Try giving your images some dimensions i.e.  style="width:320px;height:320px"

As when i do that they align fine. Do you have a live link to the page? its hard to see problem.

Easynow
0
 

Author Comment

by:TrueBlue
ID: 38743965
easynow111,

that fixed the problem with getting the two images horizontally aligned.
is there a way to get the box around the two images to be centered horizontally?
currently, it is left margin aligned.
TIA
0
 
LVL 12

Accepted Solution

by:
Dean OBrien earned 400 total points
ID: 38744017
I have made a few changes to your code.

Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Home Page</title>
<style>
#container {
	margin:auto;
         width:960px;
      height:1000px;
      background-color:#FFFFFF;
      color:#000000;
}
#banner {
      width:940px;
      height:100px;
      background-color:#81B0DA;
      color:#000000;
      border:#211D20 solid 10px;
	font-size:28px;
	text-align:center;
}
#nav {
      width:940px;
      height:30px;
      background-color:#D2D5B7;
      color:#6492C5;
      border:#211D20 solid 10px;
}
ul {
    list-style-type:none;
    text-align:center;
    margin:5px 0;;
    overflow:hidden;
}
li {
    width:14%;
    float:left;
}
a {
    display:block;
    background-color:#D2D5B7;
    text-decoration:none;
}
#images {
	margin:auto;

        border:#211D20 solid 10px;
        text-align:center;
}

.display {
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
    height: 960px; 
}

#td {
      text-align:center;
}

h1 {
      color:#D2D5B7;margin:20px;
}
</style>

</head>

<body>
<div id="container">

<div id="banner">
<h1>Maui</h1>
</div>
<div id="nav">
<ul>
 <li><a href="index.htm">Home</a></li>
 <li><a href="bumper.htm">Bumper</a></li>
 <li><a href="clothes.htm">Clothes</a></li>
 <li><a href="flag.htm">Flag</a></li>
 <li><a href="shirt.htm">Shirt</a></li>
 <li><a href="holiday.htm">Holiday</a></li>
 <li><a href="money.htm">Money</a></li>
 </ul> 
</div>

<div id="images">
<img class="display" border="0" src="kahekili maui chief.jpg" alt="" style="width:320px;height:320px"/>
<img class="display" border="0" src="maui_map.jpg" alt="" style="width:320px;height:320px"/>
</div>

</div>

</body>
</html>

Open in new window

0
 

Author Comment

by:TrueBlue
ID: 38744436
easynow111,

Perfect :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question