Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

css positioning issues, cannot get items to line up as required

Posted on 2014-12-31
4
Medium Priority
?
87 Views
Last Modified: 2015-01-01
Hi

I've got an issue with the following code which is not lining up the images / removal links as I'm after, hoping some of you gurus can easily assist.

I'm after a framed box container, then each image will also have a border "frame" with the removal link in the top right hand corner, ideally later ill alter it for an image to look better as in the image below:

I'm trying to get something like this:
require.png
But I'm actually getting this:
getting-now.png
Here is my current code:
<!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" />
<title>Untitled Document</title>
<style>
#imageGalleryContainer {
	position: relative;
	border: 1px solid #CCC;
	padding: 4px;
	position: relative;
}
#imageGalleryContainer .singleImageContainer {
	border: 1px solid #CCC;
	padding: 4px;
	float: left;
	position: relative;
	margin-right: 6px;
}
.singleImageContainer a.remove_field {
	border: 1px solid #ff6600;
	padding: 0px;
	margin: 0px;
	position: relative;
	top: 10px;
	right: 10px;
	z-index: 200;
}
.singleImageContainer img.singleImageThumbnail {
	border: 1px solid #00ff00;
	padding: 2px;
	margin: 0px;
	position: relative;
	top: 0px;
	left: 0px;
	z-index: 100;
}
</style>
</head>

<body>

    <div id="imageGalleryContainer">
    
      <div class="singleImageContainer">
        <a class="remove_field" id="o_19aglfoja1nlqjo51vcu1q8993jf.jpg" href="#">Remove</a>
        <img height="120" class="singleImageThumbnail" src="../../uploads/user/plupload/2014/12/31/o_19aglfoja1nlqjo51vcu1q8993jf.jpg">
      </div>
      
      <div class="singleImageContainer">
        <a class="remove_field" id="o_19aglflr51kjdkr6td51qlmtdu7.jpg" href="#">Remove</a>
        <img height="120" class="singleImageThumbnail" src="../../uploads/user/plupload/2014/12/31/o_19aglflr51kjdkr6td51qlmtdu7.jpg">
      </div>
      
    </div>

</body>
</html>

Open in new window

0
Comment
Question by:Neil Thompson
  • 2
4 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40525742
You have not closed the image tags, so the markup is structural flawed and invalid for an XHTML doctype.

Cd&
0
 
LVL 3

Author Comment

by:Neil Thompson
ID: 40525848
many thanks but that doesn't answer the question I posted, can you assist with that?
0
 
LVL 16

Accepted Solution

by:
HagayMandel earned 2000 total points
ID: 40526467
My suggestion:
1. In singleImageContainer class replace the 'float:left;' with 'display:inline-block;'
2. For the .singleImageContainer a.remove_field use the following:
position:absolute;
right:8px;
top:8px;
color: #fff;
border-radius: 50%;
width:18px;
height:18px;	
font: 22px/100% arial, sans-serif;
text-decoration: none;
cursor:pointer;	
text-align: center;	
background-color:red;
line-height: 18px;
white-space: nowrap;

Open in new window


3. Add the following css rule:
.singleImageContainer a.remove_field:before {
    content:"×";
}

Open in new window

4. Remove the text Remove from your a tags.

good luck
0
 
LVL 3

Author Closing Comment

by:Neil Thompson
ID: 40526632
Perfect, thanks a million HagayMandel :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Suggested Courses

886 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