Solved

css layout question

Posted on 2012-03-22
5
200 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
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 …

831 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