Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

How do we center the contents for the following css file? thanks

Posted on 2011-09-20
4
Medium Priority
?
218 Views
Last Modified: 2012-06-27
#container
{
    width: 98%;
    margin: 10px auto;
    background-color: white;
    color: #333;
   
}


#top
{
    height: 100px;
    width: 98%;
}



#topleft
{
    float: left;
    width: 20%;
}


#topcenter
{
    float: left;
    width: 55%;
}
#topright
{
    border-color: #FFFFFF;
    border-width: 5px;
    float: right;
    width: 23%;
    background-color: #800000;
    font-family: 'Times New Roman' , Times, serif;
    font-size: medium;
    color: #FFFFFF;
}
0
Comment
Question by:goodk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
QPR earned 500 total points
ID: 36571427
0
 
LVL 15

Assisted Solution

by:Jagadishwor Dulal
Jagadishwor Dulal earned 500 total points
ID: 36571450
you may have problem that you did not see the page in center that is because you have used 98% width. Your css is ok just make some fixed width for container div and for top bottom use percentage like below:

#container
{
    width: 980px;
    margin: 25% auto;
    background-color: white;
    color: #333;
   
}

Open in new window

0
 

Author Comment

by:goodk
ID: 36587429
It does not work; I was asking how the entire #topcenter div would appear in the center; not the contents.  

All I want is one container with three sections inside and all sections centered.  I know I can move the sections by putting margin-left, but this is not a proportionate solution.

If the user makes the page smaller then these sections start to move under the other.  Which is not desirable.

Anyway I am confuse.. please help!


0
 

Author Closing Comment

by:goodk
ID: 37058116
thanks for trying..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
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 tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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

649 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