Solved

Problem.s with aligning / displaying images

Posted on 2013-01-03
7
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Table doesn't show the lines! 3 34
Internet Explorer View > Style menu 3 31
title attribute 5 33
How to I read text a text box using code in another form? 9 59
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

738 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