And in beacause of the body-centering you need to add "text-align: left;" in the div to outline the text left again. About the second question, I am not sure what exactly you mean. Can you please explain what you meant?
Ill try that out right now. About the text i meant that if i draw a border around the div element and place a realy long line of text in it the text goes over the border
You could give the div a padding. That means the space between the border and the content. More about that here. Another option would be to give your paragraph a width too. Something like this:
Text, by default, should be wrapping down onto the next line automatically inside your div, you don't need to do anything special to achieve that. The two exceptions are that somewhere else in the stylesheet "white-space" got set to "no-wrap", which prevents text from breaking down onto the next line. Or, the text doesn't have any spaces in it. For example, really really long URL's. Those have a habit of wanting to stick together on one line and busting outside of div's.
my problems are:
- how do I align the div element to the center of the page
- and how do I make the overflow words go to the next line
Thanks for Helping
div {
width: 500px;
margin: 0 auto;
}
and for old browsers, also add this:
body {
text-align: center;
}
And in beacause of the body-centering you need to add "text-align: left;" in the div to outline the text left again. About the second question, I am not sure what exactly you mean. Can you please explain what you meant?
About the text i meant that if i draw a border around the div element and place a realy long line of text in it the text goes over the border
Example:
I want the navigation centered inside the header, but I don't want to constrain the width of the nav (at least not greater than the header).