_position or position? (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


FlowerPower -> _position or position? (7/13/2005 2:49:56)

I found some css code online and have adapted it to a site I am constructing, and it all seems to work fine. However, it contains the following lines, which I am a bit unsure about:

_position: relative;
_top: -50%;


Is there a difference between _position and position?
Thanks!




Tailslide -> RE: _position or position? (7/13/2005 3:46:09)

the correct syntax would be postion:relative;

Not sure where the _position would have come from...




FlowerPower -> RE: _position or position? (7/13/2005 7:27:07)

Sorry, I found it in the stylesheet for http://www.jakpsatweb.cz/css/priklady/vertical-align-final-solution-en.html, which explains a way to achieve vertical centering using css. I thought it looked strange, and when I removed the underscore it did make a difference but I couldn't quite figure out what was going on.

Thanks for the help!

By the way, if anyone knows of a simpler/better/more elegant way to achieve the vertical centering in css, I would love to know. I'm relatively new to css - that is, I can read the code and figure out most of it, but have trouble constructing it all, and designing the hierarchy (the cascading part).




c1sissy -> RE: _position or position? (7/13/2005 9:27:50)

Hi, I did a google on vertical centering for you and found out that the underscore is a hack.
http://wellstyled.com/css-underscore-hack.html

If you do a google on css vertical centering, it will bring up some links for you that have some examples, and I am sure you could view source and modify their code.




FlowerPower -> RE: _position or position? (7/13/2005 11:20:53)

Thank you very much. I will experiment. I was a bit confused by the triple nesting of divs, but I'll tinker and see if I can make some sense of it.




c1sissy -> RE: _position or position? (7/13/2005 11:49:55)

quote:

I was a bit confused by the triple nesting of divs,


Just a note to help you out here, when you do the divs, make sure you comment their opening and closing. ANd it needs to be done a certain way, or it will cause bugs within IE.
<div id="container"><!--open container div-->
your content goes in here.......
<!--close container div--></div>


Make sure that when you comment the closing div, that your comment is on the inside of the closing div.

This makes searching your code much easier, plus it helps you to find the divs when you need to either mess with the code while playing or when you are designing a page, it helps with finding it to change content.




FlowerPower -> RE: _position or position? (7/13/2005 12:04:11)

Thanks for the very useful hints. In this case, though, the problem is not so much keeping track of what I've done, but understanding what I've done in the first place.

I'm unsure why there were three layers of nested divs to center the text (in the the code on the page I mentioned above): in the page I'm working on, I want a navigation bar bang smack in the middle of the page, extending the full width of the page and always staying vertically centered. I have got it to work fine using a modified version of the code I found, and have tested it in Firefox and IE and it works well. But I may very well have created very ugly code and made it unnecessarily complicated.

Anyway, I guess that's part of the learning process. Thanks for your patient replies!




c1sissy -> RE: _position or position? (7/13/2005 12:20:55)

quote:

I'm unsure why there were three layers of nested divs to center the text

Ok, one reason why it is good to comment your code. it would make it easier to understand their layout.

Nested divs help with your layout. A container div (sometimes called a wrapper div) will do just that, contain things, and make your design easier to do, and get to work in different browsers. A container is great for floats, just make sure you use a clearing method in the container div. A good article to look up is the Aslett clearning method.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875