Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

css layout question

Posted on 2012-03-22
5
Medium Priority
?
232 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 2000 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Suggested Courses

916 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