Solved

Problem.s with aligning / displaying images

Posted on 2013-01-03
7
354 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 28

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 28

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now