Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Centre a group of images

Featured Replies

Hi,

 

I'm very new to all this so please go easy!

 

I'm creating a web page by placing a group of image slices using absolute postioning

 

e.g. <IMG STYLE="position:absolute; TOP:0px; LEFT:0px; WIDTH:36px; HEIGHT:128px" SRC="Web-concept-2-pg2_01.gif"> and then all the other images in their respective positions, you get the idea...

 

I have managed to get a coloured background behind the group of images but I need the whole group to sit in the centre of the page, how do I do this?

 

Thanks :unsure:

I don't get what you mean. :unsure: Can you post a link?

I was about to type out a solution, but then thought it's best if we know what you've got already, in order to comment properly. If you can post a link to your page, or paste your code here, then we'll be in a better position to help you. Have you got your elements inside a container <div>? It's best to create a container div and centre that on the page and then put your elements within that.

  • Author

I have barely started yet (as you can see!), but here's what I've got so far. I will have loads more images in there which will all go together to make one big image in the end (but need to be sliced up to create links) which I want in the centre of the page. Is this enough to go off?

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

 

"http://www.w3.org/TR/html4/loose.dtd">

<html>

 

<head>

<title> Orangutan Creative </title>

</head>

<body>

<body bgcolor="#333333">

<IMG STYLE="position:absolute; TOP:0px; LEFT:0px; WIDTH:36px; HEIGHT:128px" SRC="Web-concept-2-pg2_01.gif">

 

<IMG STYLE="position:absolute; TOP:0px; LEFT:36px; WIDTH:74px; HEIGHT:128px" SRC="Web-concept-2-pg2_02.gif">

 

 

 

</body>

 

 

</html>

  • 2 weeks later...

i am unsure if this will work but it works when the text,images etc is in a table its the best solution:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

 

"http://www.w3.org/TR/html4/loose.dtd">

<html>

 

<head>

<title> Orangutan Creative </title>

</head>

<body>

<body bgcolor="#333333">

<center>

<IMG STYLE="position:absolute; TOP:0px; LEFT:0px; WIDTH:36px; HEIGHT:128px" SRC="Web-concept-2-pg2_01.gif">

 

<IMG STYLE="position:absolute; TOP:0px; LEFT:36px; WIDTH:74px; HEIGHT:128px" SRC="Web-concept-2-pg2_02.gif">

 

 

 

</body>

</html>

 

If this doest work then put the images in a table and then center it with the centre tags (underlined above). It would be best if you can just dreamweaver or other web publishing software there is a free 30 day trial for it on the adobe site, once you use it you'll never go back!!

  • 4 weeks later...

This is bad advice.

 

Don't use web wysiwyg editors unless you understand HTML and CSS properly. Separate content from presentational code correctly and don't use absolute positioning unless you understand why you're using that method.

 

Floating elements for positioning is a much tidier solution.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang ="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title> Orangutan Creative </title>
<style type="text/css">
* {
padding: 0;
margin: 0;	
}
html {
min-height: 100.1% /* scrollbar fix for firefox */	
}
body {
width: 110px;
margin: 0 auto;
background-color: #333;
}
#image1 {
float: left;
width: 36px;
height: 128px;	
}
#image2 {
float: left;
width: 74px;
height: 128px;	
}
</style>

</head>
<body>
<div id="container">
	<img id="image1" src="Web-concept-2-pg2_01.gif" alt="">
	<img id="image2" src="Web-concept-2-pg2_02.gif" alt="">
</div>
</body>
</html>

 

I've set the width on the body to the size of these images as I'm not sure if there's anymore code to this layout. You could always apply the same principle on the container or create a <div id="header"> and apply the width and margins to that instead.

 

(Whilst the container isn't actually required for this page, I've included it as it would be required if there is further content to be added.)

 

Hope that helps.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.