Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Div canDiv can't be center aligned in the ascx file?
Previous
 
Next
New Post
2/10/2009 8:58 PM
 

Timo Breumelhof wrote
 

The head of the html skin does not help, you must have the "myskinname".doctpye.xml file or the skins doctype will not be XHTML

Thanks Timo.

I've added the hp.doctpye.xml file (hp.ascx is my skinname) to the folder. But still, in the ascx file, the div could not be aligned center by using "margin: 0 auto".

Do I need to change anything in the xml file?

 
New Post
2/11/2009 2:59 PM
 

Is there anyone can help here, please?

 
New Post
2/14/2009 10:48 AM
 

 Have you tried "spelling it out" ?

I have found that margin: 0px auto 0px auto;   works sometimes when margin: auto does not.

 Ian


Mutate and Survive
 
New Post
2/27/2009 5:32 AM
 

The file extension has nothing to do with it. It could be .ASPX, .ASCX, .PHP, .HTML, .WTF, etc.

The "margin: 0 auto" does not center anything. It defines your top and bottom margins as zero while your left and right margins automatically scale according to their parent element.

If your content area (.inside) weren't a defined width (in pixels, that is), you could center it using margins. Setting the width to 50% and the left and right margins to 25% each will give you a centered div that's 50% the width of its parent element (.outside). But if you're assigning a pixel-width to the .inside div while the width .outside div varies, you won't know what value to assign the margins.

 .outside {
     width: 100%;
}

.inside {
     width: 50%;
     margin: 0 25%;
}

This works, but because your inside container width is set to a percentage of the outside container, the dimensions of the outside container will ultimately determine the width of its contents.

 
New Post
2/27/2009 5:44 AM
 

Just realized this thread is a couple weeks old! Man, time flies when you're doing, uh... whatever it is I've been up to.

Anyway, here's a solution that doesn't require a text-align: center property, although it does require that you relatively position the inside div.

<div style="width: 100%;">
    <div style="width: 500px; position: relative; top: 0; left: 50%; margin-left: -250px; border: 1px solid black;">
        Content goes here...
    </div>
</div>

Hope I'm not too late.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Div canDiv can't be center aligned in the ascx file?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out