Jump to content
GIGN Forum

Kā Iecentrēt Divu?


theNTH
 Share

Recommended Posts

Uztaisiji photoshopā dīzainu, un tagad mocīšos dabūt jau caur internetpārlukprogrammu skatāmu.

Mana problēma ir tāda, ka es nesaprotu kā var nocentrēt div'us, <center> neder, biju jau meklējis informāciju, bet vēljoprojām nesanāk. Es caur div content mēģināju to visu stuffu iecentrēt.

Vajag tā, lai divs būtu iecentrēts, bet viss kas tajā iekšā - nē.

index.html

...

<body>
<div class="content">
<div class="contentTop"
<img src="images/content_top.png" />
</div>
<div class="contentBg">
<img src="images/content_bg.png" "/>
<p>Teksts.</p>
<div class="contentBottom">
<img src="images/content_bottom.png" />
</div>
</div>
</div>
</body>
</html>

style.css

body {
font-family: Tahoma;
font-size: 11px;
color:#FFFFFF;
background-color:#181818;
}

.contentTop {
width: 616px;
border:0;
}
.contentBottom {
width: 616px;
border:0;
}
.contentBg {
width: 616px;
border: 0px;
background:url(images/content_bg.png) repeat-y;
}

EDIT: paldies vincister, bet netaisiet vēl ciet topiku, noteikti radīsies vēl jautājumi.

Edited by theNTH
Link to comment
Share on other sites

First of all iesaku uzlikt doctype.

Centrēt wrapper'i, nevis katru elementu atsevišķi (tavā gadījumā: div.content) un wrapper'im izmantot id, nevis klasi :)

<div id="wrapper">
   
</div>

Centrēt var tikai to elementu, kam ir noteikts platums (loģiski, ne?)

* {
  margin: 0;
  padding: 0;
}

#wrapper {
  width: 616px;
  margin: 0 auto;
}

Edited by X ID
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...