Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

863 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

26 Experts available now in Live!

Get 1:1 Help Now