Solved

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

Posted on 2014-12-31
4
75 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:NeilT
  • 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:NeilT
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:NeilT
ID: 40526632
Perfect, thanks a million HagayMandel :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

705 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

18 Experts available now in Live!

Get 1:1 Help Now