Solved

Align div tag in center

Posted on 2016-07-17
3
34 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 53

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 53

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
This article discusses four methods for overlaying images in a container on a web page
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now