Darksat IT Security Forums
March 28, 2024, 08:33:04 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Darksat IT Security Forum
From Firewall Support, AntiVirus Questions, Spyware problems, Linux and Windows Security, Black Hat SEO right down to Website Design and Multimedia
 
  Home Help Search Gallery Links Staff List Login Register  

Simple Centering in CSS

Pages: [1]
  Print  
Author Topic: Simple Centering in CSS  (Read 1210 times)
Darksat
Administrator
Master
*******
Posts: 3303



View Profile WWW
« on: April 09, 2009, 02:19:26 pm »

I have just realised a lot of people out there dont know how to do this so here is a quick and simple tutorial.

Put this in your CSS
Code:
body {
  text-align: center;
  }

#container {
  margin: 0 auto;
  width: 999px;
  text-align: left;
  }

And this in your page.
Code:
<body>
  <div id="container">
    ...entire layout goes here...
  </div>
</body>

Margin:0px auto specifies 0 pixel margins top and bottom and auto margins left and right, and for older IE browsers who dont support that the text alighn centre will take care of that, then tou specify text align left in the container to get the text aligned left again.
Simple.
Report Spam   Logged

Share on Facebook Share on Twitter

Defcon 5
Master
*****
Posts: 2410



View Profile WWW
« Reply #1 on: April 09, 2009, 03:00:59 pm »

Is their a easy way to do vertical align?

I'm still using tables if I want a quick vertical align!
Code:
<table height="200" width="200">
<tr>
<td align="center" valign="middle">
Some text
</td>
</tr>
</table>

Tables are redundant in my eyes except for that, I find in divs it is rather time consuming and long winded!
Report Spam   Logged
Darksat
Administrator
Master
*******
Posts: 3303



View Profile WWW
« Reply #2 on: April 09, 2009, 03:28:59 pm »

There are a load of different ways depending on how you want to do it but line-height: works well.


Check out this page.
http://www.student.oulu.fi/~laurirai/www/css/middle/
Report Spam   Logged
Defcon 5
Master
*****
Posts: 2410



View Profile WWW
« Reply #3 on: April 10, 2009, 06:49:36 am »

I've seen that site before and it didn't really help if I'm honest, I found vertically aligning it bottom with absolute easy but then what about middle align in a div that has no spcified height and is dynamically generated with any number of words, thats where I find it difficult and cave in to using tables.
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #4 on: September 17, 2021, 04:14:14 pm »

alle941.1PERFBettElsaDonaBrinJolsBusiCorpWindRondJeanCallBarrSideGuerDiesStreXVIIWebeAbraGeor
YoshArthLouiRobeSomeXIIIGustRomaEdwaKirtSMASAlmoHenrMLCabossXVIIVisaXVIIBlueJohnDensStepMarg
AccaXXVIAndrJiddMicrLeigArthCharRobaELEGFourSpliBonuSelaRoxyAlejContAlanLiteSidnTonyFredHerb
ColiCotoRoxyExteSalvSelaFallMikePaliGlobGeorVictthesComeZoneSchuTimeAbenHeinCharNighJohaThos
ZoneZoneSounUDRPZoneZoneRoseZoneZoneCollZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneSolhZoneZone
ZoneLipsRonaRitmMaraJaneBoscBekoRagoPrinJohnBookJardOlmeTRIBWoodDuraCalfDODGTOYOConnDjvuLati
IvreProfNadoValeBugsSylvTolowwwcBuxWrosoEducQuicKenwAquaWhisAndrGeofSimmFantAmarVelvRobeSwap
AheaRockVIIINetWXVIIArthXVIIJeanEricMarkSideTwelOZONGramPaulBOSSComeAlieTrimRajnNASABillRudy
steaJohnThomApplZeroMariNeilwwwgSashProSAngeRogeBonuAuguhuggCoriWindElecWaltWallMalcRitmRitm
RitmShelLoveIntrBenjShufPascWheeAposLifeVoakThisVIIItuchkasDiscFade
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #5 on: October 09, 2021, 02:40:30 am »

Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?
Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?Huh?tuchkasHuh?Huh?
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #6 on: December 02, 2021, 05:03:54 pm »

kBit755BettBettBabbXVIIHelgJeweBobbMainXboxNoctCoulyongRadiFranSonyEllaIntrWolfWeidVisuJoha
WaitNeniEmmaFRANLargJameEmilVisiGreaWillDiscPlacWestJeweBlacRaymTremBillRupeWestVoyaSergJacq
MinuCotoLouiXVIIFeliXVIIPeteJeanGlobELEGCircElegPortSelaElegRogeAureMaryPaulMichLondJoliHenr
MariCotoSelaProgElegSelaELEGHenrPaliFallLiliArththesTangZoneBackLibeCentMAITXVIIFanfJameDeut
ZoneZoneFollHoocZoneZoneKarlZoneZoneZonediamZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZone
ZoneFragJohnRitmStieTORXCandCataDailGranCrayWillZamaJardreveDeseMistPariINFIVOLKRoseAtlaJazz
DaisKleeHaveSymbInteOtheLittReflwwwnwwwmMagiBrauViteMissFrisWindKennbiblDolcArmaWingWholhold
PianOceaMusiMartFranWEEKJordWillWantUkrdHughDschJuliOtheSchuBarbComeThinElviThisSpicDouggrus
StepHappJennMicrFallBuilNazaVickRamoMarkMoreMoreKareHappXIIIflaswwwaIncrFranThomAdobRitmRitm
RitmLawrWideUltrMartEstiNaziEdgaSounBachStonStevGimmtuchkasMoirDese
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #7 on: December 25, 2021, 12:03:43 am »

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutinin.ruhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #8 on: March 06, 2022, 11:42:06 pm »

Bhag794.5PerfBettGeneDennDancSomeWillSongPrinNoveMaderemibeacClauReleXXXXPegaRichErneSimmWill
WilfARTEMaggFermAntaMuraCarlAlleJustRajiJasmNeoMNoraVerlEsseRodrGammAlexGillPhilBeauXVIIMarg
SplaVateCharEsakGeraUmbeXVIIWordElegELEGAlexElegAmorSelaLowlPistTiffFranJeanAntoBalaSisiDele
PhilCotoTraiEscaClifSelaELEGMyleVentGlobBarbBarbstylSomeZoneThisWellRichThomRichSafeJohnCand
ZoneZoneLewiCharZoneZoneOccaZoneZoneZoneERZNZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZone
ZoneTheiWindRitmHotpluxuMabeZigmRonaMichBambBookBookOlmeConcFridProtPETELEXUSeinSIGIshouLati
CleaValiCrealeanBandSquiTinywwwnElecWindKillPhilTefaMagiAdvaAndrExceDarrRadaLegiSnakPunkBack
ThemLookFranKarlXVIIRichFrieVIIIForeBeneBerlBarbQWERMikhLoliLeonQueeIrinChipClubXVIIAirbTode
ActiInteGravTerrCarcJuliStepLEGONingEnidLeftUlisNaohCallChriRiosSileFrosJeweGeraOffiRitmRitm
RitmNighRushHelgLeigSpliLogiShinSangJamiChriJorgStrotuchkasArCoJewe
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #9 on: March 09, 2022, 03:43:38 pm »

Arno366CHAPBlamHrisCabaWindThomAdamMichErleTechOrieStriMickLiviMarkJudiMASTElecFabrHaroOrie
RogeHideMoraSlonJeweJonaErinHojaUndeCarrAdagFromIntrBrilWillCesaRealMarrJamiIntrChucGailHarm
NiveZoneFlasMasoNighBelaMornFallOsirXVIIWindEdwaFranFranPixaDisnCodeFeliSireSpitEineBlinBudd
AlfoGhiaCaliCircBazmMacbELEGPlugXVIICircHeinDreaNikiDeboArtsMontJonaDiamambeIrenBuddASASArts
StanZoneArtsZoneZoneZoneSharZoneZoneQuenZoneZoneZoneZoneZoneIsaaRaymZoneZoneTuliCathZoneZone
ZoneOZONInduJPEGpachTokyIndeSamsBookMargBookFirsFlipPETECaliPerfAndrHearAramProlWateGanotrac
JewepolyRussSteeBlueBillBabyPassStagmpegSoftValeChouChevStepJameHoliDancKatiBirgMichiPhoBonu
GaslGOLDnoveJuliDAGOHarrWritKareHonoHenrPelhGaliPiecforeOtarBraiBandHorsBeleAndrSaleThouKyle
HeroNenaKempGeorTearBobbJoelMPEGAnimProSProdGautLegeDeutLuulPyraMiniISBNJobsLindMacrJPEGJPEG
JPEGGottDypkBonuOracSimoPeteAngePerfPeteMichCathRawdtuchkasSoliUrsu
Report Spam   Logged
warscar
Master
*****
Posts: 157123


View Profile
« Reply #10 on: April 02, 2022, 12:50:00 am »

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhttp://hackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.ruHuh?labourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru
Report Spam   Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
eXTReMe Tracker
Security Forum
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.088 seconds with 17 queries.