Solved

Align div tag in center

Posted on 2016-07-17
3
39 Views
Last Modified: 2016-07-17
Hello;

I have 2 div one is above the other as below:
i want that align <div class="logo-ads"> in center.

<header>
 <div class="wrap">
  <div class="headerdiv">
 </div>
  <div class="logo-ads">
  </div>
 </div><!-- end of header wrap -->
</header>

/css--/

/*header elements*/
.headerdiv{
	height:35px;
    width: 100%px;
    background-color: #bb0700;
	padding-right: 0px;
   z-index: 0;
   
  }
  .logo-ads{
	height: 110px;
	width: 980px;
	background-color: #CFD1A9;
	padding-right: 0px;
	position: absolute;

	margin-top: 0px;
	margin-right: auto;
	margin-left: auto;
	margin-bottom: 0px;
	z-index: 1;
	
	}

Open in new window

thanks
0
Comment
Question by:MOSTAGHASSI
  • 2
3 Comments
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41715672
Two problems
1. Line 15
 width: 100%px;

Open in new window

Should be
 width: 100%;

Open in new window


2. Line 26
position: absolute;

Open in new window


Remove the position absolute - it negates the margin: 0 auto
0
 

Author Comment

by:MOSTAGHASSI
ID: 41715728
Thanks,it works,and i found on experts-exchange that we can also use from tag  <center></center> on html codes above the div , and i tested it, and it work,do you think is it ok that we use from <center> tag?
0
 
LVL 54

Expert Comment

by:Julian Hansen
ID: 41715782
Just bear in mind <center> has been deprecated in HTML 5 - avoid using it.
1

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
css help with menu spacing 10 47
Only three borders showing on image 5 20
Changing alignment and creating border 6 29
Increase the size of the modal in Bootstrap 5 27
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…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

832 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