Solved

css layout question

Posted on 2012-03-22
5
192 Views
Last Modified: 2012-03-23
Hi Guys,

I downloaded a template to use in visual web developer 2010 express.
In the header there is the logo on the left, and the copyright section to the right.
I created a new <div>="TESTAREA" and the goal is to put the box in the middle, same height, as the logo and copyright section.  I cant seem to center this between the right and left, any suggestions?

thanks



	<div id="header">
		<div id="logo">
			<h1><a href="#">Big Business</a></h1>
		</div>

        <div id=TESTAREA">
  
        <h1>this is my new area</h1>
        
            </div>





		<div id="slogan">
			<h2>Template design by Free CSS Templates</h2>
		</div>
	</div>

Open in new window



#header {
	height: 75px;
	position: relative;
	background: #6E6E6E url(images/img03.jpg) top left no-repeat;
	padding: 45px;
	color: #FFFFFF;
	width: 888px;
	border: solid 1px #7E7E7E;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
	overflow: hidden;
}

#logo {
	line-height: 160px;
	height: 160px;
	padding: 5px 0 0 0;
	position: absolute;
	top: 0;
	left: 45px;
    width: 279px;
}

#logo a {
	text-decoration: none;
	color: #FFFFFF;
	text-shadow: 0 1px 1px #3E3E3E;
}

#logo h1 {
	font-size: 3.25em;
}

#slogan {
	line-height: 160px;
	height: 160px;
	padding: 5px 0 0 0;
	position: absolute;
	right: 45px;
	top: 0;
}

#slogan h2 {
	color: #BEBEBE;
	font-size: 1.25em;
	text-shadow: 0 1px 1px #3E3E3E;
}

#TESTAREA {
    line-height: 160px;
    height:160px;
    padding: 5px 0 0 0;
    position:absolute;
    top:0;
    
}

Open in new window

0
Comment
Question by:solarissf
  • 3
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 37754176
You already have position:absolute in the TEXTAREA div so just add left:330px to push the div left as far as you need it. Adjust top as desired.
0
 

Author Comment

by:solarissf
ID: 37754200
added, but doesnt move at all????
#TESTAREA {
    line-height: 160px;
    height:160px;
    padding: 5px 0 0 0;
    position:absolute;
    left:700px;
    top:0;
   
}


nevermind... it did move... other than moving it visually , is there a way to center it?
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37754204
Your div is missing a quote around TEXTAREA.
0
 

Author Comment

by:solarissf
ID: 37754366
thanks,  is there a way to actually center it between other 2 elements?
0
 
LVL 38

Assisted Solution

by:Tom Beck
Tom Beck earned 500 total points
ID: 37754464
Sure. You could remove all the position:absolute, top, right, and left then add float:left and margin:auto to the slogan, logo and TEXTAREA.
#header {
      height: 75px;
      position: relative;
      background: #6E6E6E url(images/img03.jpg) top left no-repeat;
      color: #FFFFFF;
      padding:45px;
      width: 888px;
      border: solid 1px #7E7E7E;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
      overflow: hidden;
}

#logo {
      line-height: 60px;
      height: 160px;
      padding: 5px 0 0 0;
    width: 279px;
    float:left;
    margin:auto
}

#logo a {
      text-decoration: none;
      color: #FFFFFF;
      text-shadow: 0 1px 1px #3E3E3E;
}

#logo h1 {
      font-size: 3.25em;
}

#slogan {
      line-height: 60px;
      height: 160px;
      padding: 5px 0 0 0;
      float:left;
    margin:auto
}

#slogan h2 {
      color: #BEBEBE;
      font-size: 1.25em;
      text-shadow: 0 1px 1px #3E3E3E;
}

#TESTAREA {
    line-height: 60px;
    height:160px;
    padding: 5px 0 0 0;
    left:330px;
    float:left;
    margin:auto
   
}

I also reduced the line-height to 60px. I'm not even sure why that's there to begin with.
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

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 …
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 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…
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…

943 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

1 Experts available now in Live!

Get 1:1 Help Now