Wednesday 22nd of February 2017 01:52:59 PM

center a FIXED BOX

This BOX has a fixed width.
It is centered and adjusts to the browser window.
The height adjusts to the content.
more nice and free css templates

body {
background-color: #e1ddd9;
font-size: 12px;
color:#564b47;
padding:20px;
margin:0px;
text-align: center;
}
#inhalt {
text-align: left;
vertical-align: middle;
margin: 0px auto;
padding: 0px;
width: 550px;
background-color: #ffffff;
border: 1px dashed #564b47;
}

Figure 7-24

Figure 7-24. An inline element with a 10-pixel margin

This all seems simple enough, but when the boldfaced text stretchesacross multiple lines, the situation becomes a little odd. First,realize that the margins set for inline elements are not applied atthe point where line-breaking occurs. This line-breaking happens inthe course of wrapping text so that it fits inside thebrowser's window, for example, or inside a parent element. Theonly effect margins have on line-breaking is that, by causing extraspace to appear within the line, they can move content over. This may document, half as wide as the document's width and overwritingthe first few elements!

In addition, if the document is scrolled, the paragraph will scrollright along with it. This is because the element's containingblock is the BODY element's content area,not the viewport. If you want to position elements so thatthey're placed relative to the viewport and don't scrollalong with the rest of the document, then the next section is foryou. define "global" styles, widths, and colors. In otherwords, the values you supply for border will applyto all four sides equally. If you want the borders to be differentfor a single element, you'll need to use some of the otherborder properties. Of course, it's possible to turn thecascade to your advantage:

H1 {border: thick silver solid;border-left-width: 20px;}

The second rule overrides the width value for the left border will simply substitute some other font, and the effect you want may be diminished or lost.  The <BASEFONT> or <FONT> tags can list multiple fonts in order of preference.  The list should include a generic font family as a last resort, e.g.
   <FONT FACE="Creepy, Times New Roman, serif">
Generic font families include serif, sans-serif, monospace, cursive and fantasy

Note that as of HTML 4, you are encouraged to use style sheets instead of these in-line font manipulations, but these tags work fine.