Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
[CSS] Wyśrodkowanie strony
#1
Za pomocą generatora zrobiłem sobie taki szablon. Jednak za pomocą css za nic nie mogę go wyśrodkować.
Ustawiam margin: 0 auto; wszystko biorę w <div id="wrapper"> i nic.
Kod:
*{
margin:0;
padding:0;
}
div#wrapper {
width: 894px;
margin-left: auto;
margin-right: auto;
padding: 5px 5px 5px 5px;
margin: 0;
}
#block_1
    {
    float: left;
    width: 2px;
    margin-left: 567px;
background:url('/images/separator.gif') repeat center;
    }
* html #block_1
    {
    display: inline;
    }
#block_2
    {
    float: left;
    width: 567px;
    margin-left: -569px;
background-color: gray;
    }
#block_3
    {
    float: left;
    width: 305px;
    }
/* Start Mac IE5 filter \*/
#block_1, #block_2, #block_3
    {
    padding-bottom: 32767px !important;
    margin-bottom: -32767px !important;
    }
@media all and (min-width: 0px) {
#block_1, #block_2, #block_3
    {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    }
#block_1:before, #block_2:before, #block_3:before
    {
    content: '[DO NOT LEAVE IT IS NOT REAL]';
    display: block;
    background: inherit;
    padding-top: 32767px !important;
    margin-bottom: -32767px !important;
    height: 0;
    }
}
/* End Mac IE5 filter */
/* IE Win can be a bit out - you might need to adjust  
bottom value by -1px or as required */
.verticalalign
    {
    position: absolute;
    bottom: 0;
    }
#block_1 .verticalalign
    {
    width: 2px;
    }
#block_2 .verticalalign
    {
    width: 567px;
    }
#block_3 .verticalalign
    {
    width: 305px;
    }
/* hack for Opera 7+ */
@media all and (min-width: 0px){
.verticalalign
    {
    width: 100% !important;
    }
/* But Opera 9 does it right, so CSS3 hax to the max */
div[id^="container"] #block_1 .verticalalign
    {
    width: 2px !important;
    }
div[id^="container"] #block_2 .verticalalign
    {
    width: 567px !important;
    }
div[id^="container"] #block_3 .verticalalign
    {
    width: 305px !important;
    }
}
/* hack for IEs of all persuasions before IE7 */
* html .verticalalign
    {
    width: 100% !important;
    }
.verticalalign p
    {
    position: absolute;
    bottom: 0;
    right: 0;
    margin: 0;
    padding: 0;
    background: #996666;
    }
#container_extra
    {
    position: relative;
    }
* html #container
    {
    position: relative;
    }
#container
    {
    width: 874px;
    overflow: hidden; /* This hides the excess padding in non-IE browsers */
    }
/* we need this for IE 5.01 - otherwise the columns vanish */
* html #container_extra
    {
    float: right;
    width: 100%;
    }
/* we need this for IE 5.01 - otherwise the wrapper does not expand to the
necessary height (unless fixed, this problem becomes even more acute
weirdness as the method is enhanced */
#container
    {
/* Normally a Holly-style hack height: 1% would suffice but that causes
IE 5.01 to completely collapse the wrapper - instead we float it */
    float: right;
/* NB. possibly only IE 5.01 needs to get this float value - otherwise 5.5 sometimes
(I saw it happen many moons ago) makes the width of wrapper too small
the float: none with the comment is ignored by 5.01,
5.5 and above see it and carry on about their business
It's probably fine to just remove it, but it's left here
just in case that many moons ago problem rears its head again */
    float/**/: none;
    }
/* easy clearing */
#container:after
    {
    content: '[DO NOT LEAVE IT IS NOT REAL]';
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
    }
#container
    {
    display: inline-block;
    }
/*\*/
#container
    {
    display: block;
    }
/* end easy clearing */
#footer
    {
    clear: both;
    }
#header, #footer
    {
    width: 874px;
    }
/* Safari needs this - otherwise the ghost overflow, though painted
correctly obscures links and form elements that by rights should be above it.
An unintended side-effect is that it cause such elements to vanish in IE 5.01
and 5.5, hence the child selector hack */
* > #footer, * > form, * > #notes, * > .output
    {
    position: relative;
    z-index: 1000;
    }
Odpowiedz


Wiadomości w tym wątku
[CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 17:26
RE: [CSS] Wyśrodkowanie strony - przez nd_macias - 21-06-2011, 17:33
RE: [CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 17:56
RE: [CSS] Wyśrodkowanie strony - przez nd_macias - 21-06-2011, 18:00
RE: [CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 18:10
RE: [CSS] Wyśrodkowanie strony - przez nd_macias - 21-06-2011, 18:40
RE: [CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 19:00
RE: [CSS] Wyśrodkowanie strony - przez nd_macias - 21-06-2011, 19:20
RE: [CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 19:27
RE: [CSS] Wyśrodkowanie strony - przez Kartofelek - 21-06-2011, 19:30
RE: [CSS] Wyśrodkowanie strony - przez nd_macias - 21-06-2011, 19:31
RE: [CSS] Wyśrodkowanie strony - przez PiotrN. - 21-06-2011, 19:40
RE: [CSS] Wyśrodkowanie strony - przez jacob_17 - 12-10-2011, 19:06

Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
  wyśrodkowanie obrazka discoratka 4 4,526 23-08-2013, 03:29
Ostatni post: Kartofelek
  wyśrodkowanie obiektów w <div><ul><li><a> [email protected] 5 4,332 02-01-2013, 03:30
Ostatni post: macder
Sad [Problem] Wyśrodkowanie div'a LAron 2 2,959 04-12-2012, 03:30
Ostatni post: LAron
  [css] wysrodkowanie szerokiego diva grzesiek77 3 3,993 18-05-2012, 00:41
Ostatni post: Heyek
  [CSS] Wyśrodkowanie elementu z automatyczną szerokością dawc 1 2,459 16-05-2012, 16:16
Ostatni post: Kartofelek

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości
Sponsorzy i przyjaciele
SeoHost.pl