Solved

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

Posted on 2014-12-31
4
79 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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

770 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