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
Solved

Align div tag in center

Posted on 2016-07-17
3
41 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 55

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 55

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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
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 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…

856 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