?
Solved

Align div tag in center

Posted on 2016-07-17
3
Medium Priority
?
60 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
[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
3 Comments
 
LVL 58

Accepted Solution

by:
Julian Hansen earned 2000 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 58

Expert Comment

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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