[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

Centring DIV within another DIV

Asked by AndyReed in Cascading Style Sheets (CSS), Dynamic HTML (DHTML), Hypertext Markup Language (HTML)

Tags: CSS, Firefox, IE6&7

Hi,

I'm currently moving our website from its old table based layout to DIV based positioning. I'm having some difficulty getting some content vertically and horizontally centred within a parent DIV.

I have a page which contains a number of supplier logos and links. These can vary in size slightly so are contained within a nice rounded edge frame. That works fine but what I'm trying to achieve is the supplier logo and link neatly centred within the rounded edge frame.

I can get this working if I position the interior DIV precisely using values for one image and text but I can't figure out how to come up with a generic CSS style that will handle any image and text length. Is there some way of making my interior DIV always centred within its parent?

I've attached a mocked up view of what I'm trying to do. Any assistance would be greatly appreciated.

Best regards,
Andy
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <style>
 
h3
{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #000080;
	margin: 0px;
}
 
/* ---=== border code follows ===--- */
/*
	tlc = top left corner
	trc = top right corner
	blc = bottom left corner
	brc = bottom right corner
	lb = left border
	rb = right border
	tb = top border
	bb = bottom border 
*/
 
#tlc, #trc, #blc, #brc
	{
	background-color: transparent;
	background-repeat: no-repeat;
	}
 
#tlc
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-TopLeft.gif);
	background-position: 0% 0%;
	}
 
#trc
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-TopRight.gif);
	background-position: 100% 0%;
	}
	
#blc
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-BottomLeft.gif);
	background-position: 0% 100%;
	}
 
#brc
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-BottomRight.gif);
	background-position: 100% 100%;
	}
 
#tb, #bb
	{
	background-color: transparent;
	background-repeat: repeat-x;
	}
			
#tb
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-Top.gif);
	background-position: 0% 0%;
	}
 
#bb
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-Bottom.gif);
	background-position: 50% 100%;
	}
	
#rb
	{
	background-image:url(http://www.security-supplies.co.uk/Images/Box-Right.gif);
	background-position: 100% 0%;
	background-repeat: repeat-y;
	}
 
#lb
	{
	background-color: #F3F3F3;
	background-image:url(http://www.security-supplies.co.uk/Images/Box-Left.gif);
	background-position: 0% 100%;
	background-repeat: repeat-y;
	}
	
#content
	{
	padding:10px;
	}
	
#supplierLinkBox
	{
	position:relative;
	margin-left: auto;
	margin-right: auto;	
	margin-top: auto;
	padding: 0;
	text-align: left;
 	background-color: #eeeeee;
	float:left;
	}
	
#supplierLink
    {
        height: 200px;
        width: 200px;
    }   
 
 
</style>
</head>
<body>
    <div id="supplierLinkBox">
        <div id="lb">
            <div id="rb">
                <div id="bb">
                    <div id="blc">
                        <div id="brc">
                            <div id="tb">
                                <div id="tlc">
                                    <div id="trc">
                                        <div id="content">
                                            <div id="supplierLink">
                                                <img src="http://www.security-supplies.co.uk/Images/NewsScroller/C-Tec.gif" />
                                                <h3>
                                                    Test Text</h3>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="supplierLinkBox">
        <div id="lb">
            <div id="rb">
                <div id="bb">
                    <div id="blc">
                        <div id="brc">
                            <div id="tb">
                                <div id="tlc">
                                    <div id="trc">
                                        <div id="content">
                                            <div id="supplierLink">
                                                <img src="http://www.security-supplies.co.uk/Images/NewsScroller/Dycon.gif" />
                                                <h3>
                                                    More Test Text</h3>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
Attachments:
 
Mock up of desired layout
Mock up of desired layout
 
[+][-]09/09/08 05:17 PM, ID: 22433623Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Cascading Style Sheets (CSS), Dynamic HTML (DHTML), Hypertext Markup Language (HTML)
Tags: CSS, Firefox, IE6&amp;7
Sign Up Now!
Solution Provided By: carazuul
Participating Experts: 1
Solution Grade: A
 
[+][-]09/09/08 01:04 PM, ID: 22431633Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/09/08 01:30 PM, ID: 22431919Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/09/08 02:12 PM, ID: 22432347Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/09/08 03:12 PM, ID: 22432831Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/09/08 04:59 PM, ID: 22433555Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/10/08 12:28 AM, ID: 22435932Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628