Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Trouble Relatively Centering an Text Element Reply To: Trouble Relatively Centering an Text Element

#236491
bearhead
Participant

Take a look at this pen:

http://codepen.io/kvana/pen/EPmayv

I cleaned up your html and css. In codepen you don’t need head and body tags. Any css or js that is in the head should be included via the “pen settings” modal.

I edited the css, so that .feature would be centered horizontally and vertically (It seemed like that was what you were after?)

Also, I noticed some incorrect syntax. In your html, your nav ul was structured incorrectly. In a ul, only an li element can be a direct child. You had some divs in there that were messing things up.

There was also a problem with how you wrote the css for the body background. I rewrote the declarations individually, so you could see how those are supposed to work.