Solved

Align div tag in center

Posted on 2016-07-17
3
30 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 51

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 51

Expert Comment

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
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…

762 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

23 Experts available now in Live!

Get 1:1 Help Now