University Web Developers

University Web Developers

I am having the hardest time making margin settings stick in Firefox.

I have used :
div#container {
margin-left: auto;
margin-right: auto;
width: XXpx;
}

and it just doesn't seem to work.

I have also tried setting my margins to zero. I have other isssues with CSS but this is the one that is bugging me the most right now. I have been forced to do some very ugly things to get my margins to act right.

Can anyone help?!?

Views: 27

Replies to This Discussion

Are you trying to centre #container? Try making it's parent element's position either relative or absolute.
Yep, I will post the problem in the next couple of days so that we can look at it together. As you probably seen in the other reply I stuck it in a to show properly. I know - I know.
can you share a link to the page? The problem is probably with the elements around it, more than the code you have. Firefox is usually pretty easy to work with, so it should be very simple to fix.
I have torn the page into pieces. I will try to recreate the problem in the next couple of days. I did something VERY ugly to get it ready to show... are you ready.... I stuck it in a
of a table. I will bring it out of the table and show you guys - thanks for all the help
My work around is having to put both for IE and Firefox. For Firefox I put "!important" after the px and before the ; I found this solution out on the web.

padding-top: 6px;
padding-top: 8px!important;
What does the !important tell the browser?
it says hey do this nomartter what. Kathy's code cancels each other.
Can you say more what you need to do? margin-left/right: auto; is used to center the element. However you need to define a width, unless you set the display to block. By default a div is width:100%. One thing to try is to remove the div from above. Sometimes the browser thinks this says container is a child. So it is looking for
<div>
<div id="container">
</div>
</div>
hi shere hicks...what aer you trying to fix? can you ftp your file so that we could you help you to re-align whatever problems do you have?
To aggregate some of the comments already made, and to add a little bit of information I've found to be helpful in my own use of "margin: auto", here are my thoughts:
1) The div#container has to be a block-level element. If any of your CSS anywhere switched your divs to inline, inline-block or whatever, you will need to explicitly redeclare the fact that div#container should be block
2) An automatic margin only works if you define a specific width for the div. I'm assuming you have done so, since your example has "XXpx" set as the width (I'm hoping you didn't actually use "XX" in your CSS declaration).
3) It is helpful to declare "text-align: center" for the parent node of div#container, then redeclare "text-align: left" for the div#container. That is the only way I've been able to get my container div centered consistently within IE (the auto margin worked just fine for Firefox, but never worked in IE).
4) Make sure you don't have any floats that might be pushing your container in any direction. Floats that are not cleared properly will mess up the margins of your div#container.
5) Just to clarify - you do want div#container to be centered on the page, not something found inside of div#container, right?
To center a div do this:

#container {margin: 0 auto; width:xx px;}

or

#container {margin-left: 0 auto; margin-right: 0 auto; width:xx px;}
could you supply a link to the page? As others have stated it's not entirely clear what your issue is from the code you posted.

The code you have supplied will 100% give you a centered div in the browser window (again as others have said assuming you actually assigned values to xx in the width). Weirdly firefox is one of the browsers that absolutely shouldn't give you any problems on this front (unlike ie6 which benefits from the text-align 'hack' - I say hack but actually the code still validates).

Again as others have mentioned there might be some floating divs causing issues? Try adding clear:both; and see if that changes anything.

RSS

Elsewhere

Latest Activity

Profile IconBilly McDonald and Meg Thomas joined University Web Developers
23 hours ago
Daniel Bashaw replied to Kimbel Jeffers's discussion Office Reservation software
"Hi Kimbel -- Does you manual process include a checklist and workflow documentation? If not, it sounds to me like checklists and schedulers are your best next steps. You can structure and document what you do now, and then look at it to see if there…"
Friday
Kimbel Jeffers replied to Kimbel Jeffers's discussion Office Reservation software
"The problem is we use a manual process right now and things keep falling through the cracks."
Thursday
Annette Spearman replied to Derek Tonn's discussion Freelance web design recommendations (small projects)
"Hi Derek, We can help you! I'll in box you all my info so we can connect and set up some time to talk. Annette "
Thursday
Mark Rothbaum posted a discussion

5-Minute Survey on Use of Facebook in Admissions

We're conducting our annual survey on Facebook and Admissions. Please take a few minutes to complete the survey at:http://www.varsityoutreach.com/FacebookSurvey/Our GoalOur goal is to explore trends related to how schools are using Facebook to reach out to prospective and admitted students.How Is the Data Used?All data will be shown in the aggregate. Answers from individual schools will not be released and will remain…See More
Thursday
Profile IconSang Yoon and Brittany Smith joined University Web Developers
Wednesday
Colleen Brennan-Barry posted a discussion

HighEdWeb Welcomes Steve Wozniak & Scott Stratten

HighEdWeb is very pleased to announce HighEdWeb 2013 Annual Conference opening keynote speaker Steve Wozniak and closing keynote speaker…See More
May 15
faris ahmed commented on social networking web design's blog post Megastar Media Webby Award Honorees
"wow thats amazing article .  your stuff never fails to amaze me honestly . great work as always :D  something i would like to add in is that  the entries each year are rapidly increasing .  but i think thats cause they take the…"
May 14
Lynn Zawie posted a discussion

Freelance Web Developer Needed

Stony Brook University web team is looking for some help coding a new design.  HTML5, CSS3, JQuery, Responsive Design expertise needed.  If you are interested in bidding on this project, I am happy to share more details.  Work would need to begin early summer.  ..LynnSee More
May 14
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Great blog post by Higher Education Marketing on leveraging Google pay-per-click ad extensions for higher ed."
May 14
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Check out Naropa University's new online magazine. Looks awesome! Great job team."
May 13
Norma J Dowell replied to Derek Tonn's discussion Freelance web design recommendations (small projects)
"Hi Derek! First of all, apologies for taking so long to respond! Secondly, I am not your web developer for such an issue, but if you can find someone to pick their brain and use as a sounding board, it may be all you need.  In the past, when I…"
May 13
Daniel Bashaw replied to Kimbel Jeffers's discussion Office Reservation software
"Hi Kimbel. I know you've been tasked with finding a software solution, though I'm wondering if you may need an interim step first: Does your institution have checklists covering all of the steps needed in on-boarding, relocating, and…"
May 13
Kimbel Jeffers posted a discussion

Office Reservation software

I've been tasked with finding a software tool that helps manage the onboarding and exit process of new and departing faculty. Ultimately i would like this software to management faculty office interms of when resources can be removed from a particular office and when a new faculty member can be moved in with the necessary resources. This tool should have notifications and alerts so there are no conflicts with someone being removed from a office and someone being placed in a office. Does anyone…See More
May 11
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Congrats to Harper College on going live with their new online course catalog! Looks great!"
May 10
Helen Mosher joined Aaron Rester's group
May 9
Helen Mosher joined Mark Greenfield's group
May 9
Helen Mosher posted a status
"After 8 years being away from higher-ed communications work, I'm very interested in returning."
May 9
Will Martin is now a member of University Web Developers
May 6
Sarah McMaster replied to Katra Farah's discussion Online chat interfaces
"Thanks, Daniel. We don't currently have any livechat solution so this is new fact-finding territory for us! I will keep the forum posted as/if we are able to move forward."
May 3

UWEBD has been in existence for more than 10 years and is the very best email discussion list on the Internet, in any industry, on any topic

About

© 2013   Created by Mark Greenfield.

Badges  |  Report an Issue  |  Terms of Service