Nic727 Posted February 10, 2016 Share Posted February 10, 2016 Hi, I'm trying to get some titles to stick to the sides of a div containing text. I would like to make a kind of square around the text, but now I use position absolute and % and when resizing the screen, it doesn't look like expected. Do you have some advices? http://codepen.io/anon/pen/YwdqNY Thank you Link to comment Share on other sites More sharing options...
davej Posted February 10, 2016 Share Posted February 10, 2016 It's usually best to keep position absolute inside position relative. For a normal layout you should be using the natural flow of the page. Link to comment Share on other sites More sharing options...
Nic727 Posted February 10, 2016 Author Share Posted February 10, 2016 Hi, I changed how it look. I had too much problem with that. Look the new code. Can you help me to center the button? Link to comment Share on other sites More sharing options...
davej Posted February 11, 2016 Share Posted February 11, 2016 Add text-align:center to the body style. Link to comment Share on other sites More sharing options...
Nic727 Posted February 11, 2016 Author Share Posted February 11, 2016 (edited) Add text-align:center to the body style. But everything will be centered on the page... EDIT : I found a way... I put the button text in a span and the span inside a div. The only thing is that I need to write a width for the div and I can do a margin 0 auto and it will be centered. Edited February 11, 2016 by Nic727 Link to comment Share on other sites More sharing options...
davej Posted February 11, 2016 Share Posted February 11, 2016 Huh? If you don't want to put text-align:center on the body, then you could put a div around your button and apply text-align:center to that added div. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now