Login | Register | FAQ
Anonymous

Auto width in divs without enter width

+ Post a reply

1, 2


Auto width in divs without enter width

by csskiller89 » Mon May 23, 2011 1:42 pm

Hello,

I have the follow easy html code.

Code: Select all
<body style="text-align: center; font-size: 20pt;">
<div style="width: 900px; height: 500px; background: #FF9;">
<div id="left" style="float: left; padding-left: 20px; width: 200px; background: grey;">left</div>
<div id="center" style="float: left; width: auto; background: green;">center</div>
<div id="right" style="float: left; width: auto; background: #9F9;">right</div>
</div>
</body>


How I get the result from the follow code without enter the width of id: left, center, right

Code: Select all
<body style="text-align: center; font-size: 20pt;">
<div style="width: 900px; height: 500px; background: #FF9;">
<div id="left" style="float: left; padding-left: 20px; width: 200px; background: grey;">left</div>
<div id="center" style="float: left; width: 340px; background: green;">center</div>
<div id="right" style="float: left; width: 340px; background: #9F9;">right</div>
</div>
</body>


Thank you

Attachments

  1. Padding_Width.png (21.85 KiB) Downloaded 1584 times

User avatar

csskiller89

  • Posts: 3
  • Joined: Mon May 23, 2011 1:39 pm

Re: Auto width in divs without enter width

by HTML.net » Mon May 23, 2011 1:54 pm

Can you use procent instead: width: 30%

- Andreas, HTML.net
User avatar

HTML.net
Site Admin

  • Posts: 1184
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.

Re: Auto width in divs without enter width

by csskiller89 » Mon May 23, 2011 2:17 pm

HTML.net wrote:Can you use procent instead: width: 30%

- Andreas, HTML.net


Hello Andreas, thanks for your quick answer.

I don't want to use percent. But if I use percent the result is not good.

See the attachment please.

Thanks.

Attachments

  1. Padding_Width2_Percent.png (25.39 KiB) Downloaded 1410 times

User avatar

csskiller89

  • Posts: 3
  • Joined: Mon May 23, 2011 1:39 pm

Re: Auto width in divs without enter width

by csskiller89 » Mon May 23, 2011 4:22 pm

CubeSquare wrote:With a division width of 900px, left, right and center should add up to 900px. #left width 200px + 20px padding-left = 220px = 24%

Using a percentage means that your percentages must add up to 100%

24% + 38% + 38% = 100% So, percentage should work.

-CubeSquare


Hello CubeSquare, thanks for reply.
It does not works correctly. Please, see the attachment.

Any other ideas?

Attachments

  1. Padding_Width3_Percent.png (22.16 KiB) Downloaded 1351 times

User avatar

csskiller89

  • Posts: 3
  • Joined: Mon May 23, 2011 1:39 pm

Re: Auto width in divs without enter width

by HTML.net » Mon May 23, 2011 5:32 pm

You should just set padding and margin to 0:

Code: Select all
<div style="width:900px; padding:0, margin:0; background:green;">
      <div style="width:33%; padding:0, margin:0; background:red; float:left">Column 1</div>
      <div style="width:33%; padding:0, margin:0; background:blue; float:left">Column 2</div>
      <div style="width:34%; padding:0, margin:0; background:yellow; float:left">Column 3</div>
   </div>


- Andreas, HTML.net
User avatar

HTML.net
Site Admin

  • Posts: 1184
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.

Re: Auto width in divs without enter width

by vergar » Sun Apr 28, 2019 4:26 am

Петр23.8BettBettMusiWaltАмерЗоттMullЛарихороJohnрассРоссBrazфакуNX10КлимручкинстклейсостS900
RivaRafaXVIIMichXVIIзащиTibeDeadиспоКиреSereAquaCharВиноязыкMurpЧосиVampcombСлон4CS2DownВишн
ПортBonuJeweArktLighКарзАртиHBecЛариБрумРуткПрохPushмелоSelaPaliProgБадибейсYorkСобоавтоPush
ГоляШтейElegмолнКогиСредСалеZoneChicЦветZoneZonePaliSakyКочеKarlсбордобрБариПетрJameZoneШкур
мгноZoneTerrPeteGeleZoneZoneZoneZone1177КокоВаргZoneXVIIПрийXVIIменяПанкОльгXVII03-0ZoneZone
ZoneорнакрасEpluоткрПроиHotpMystWannArisлитьРоссСмирOlmeJosi2108VanbКоваТрухARAGХрисдолгCoun
SoloSuprBeadXIIIРазмсумоSmarWindwwwdMoulPoweEconSiemшортPlanЛитРANDRKateXVIIЛитРUPLIЛитРЛитв
ЛитРКороМуллКяулЛевиСемеHerbКазашестBildСодеStepпесеJeweJeweBonuМолчFilmDooriOneJeweпотеСума
серд307-ЯворМогииздаШляпЛевшСтепМедеErneприрJethBonuВискПимеThisЩеглсослLewiавтофольEpluEplu
EpluдобрSnowArleЛидиЗигуGobbпансФормгероСлепстраМельHaroГанц
User avatar

vergar
Online

  • Posts: 302676
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: Auto width in divs without enter width

by vergar » Tue May 28, 2019 6:23 am

нами360.9PERFRefrХореСокоН-51раннШабуАМСаДавиE254УтчеМураMarvнаучbookБулаШлафDekoрозеТрухStef
FyodTesc4040R531GeorDoroсертCeleJuleAlfrLuciСтойуслоPerfRelaKeraAquaDropNL07AlexpentPaleувол
ИсаеBreaElleсертCotoсертУкраnachливеCurtмонаКоваДворPaulArthQuikSilvAgesPrinPrinElsaIrisдруг
FritIlluДунаXVIIЛугоиллюClifZoneсоюзшироdiamdiamканословпроц3210ZoneхоррNasoхар-WilhZoneZone
Царс7485ИллюКресLopeКостPierПогооконавтодейсМилоЗаваЦветдругсодеRudoXVIIЧернИллюМороистовосп
JacqнаобВоскDIVXхороВолкElecграмDigiТихоДранСодеиздаMariHallStriMistкамнBlueначаКамбВетеtrac
МаксFlatCreaиздеэффефигуChrywwwradvaавтоBricConnсертTAXIкомпКрысЛитРХоруTheoSileЛитРМалаКали
ScorЛесиRobePeteписаМакоЗайцФилиЛитеVIIIEricYevgФигуSnakНечипослSpahСтавChucdazzJohnJaneИнге
словВолоавтоЗубародиТарапостСкориздакурсЗайцМороHennФомиПопоVendМелеJeweШкляДолиЗверDIVXDIVX
DIVX16,5StevВасюавтоWhenвозрSticHickЛибеИвашSoulWindАтлаИндо
User avatar

vergar
Online

  • Posts: 302676
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: Auto width in divs without enter width

by vergar » Mon Jul 22, 2019 4:27 pm

расс368.1следBettChriРогоIntrSenzармимузыизмеСамоНениТараКовтNichMoreJeweTescGaryГотоSupeJere
MissJeweФранKosiКороActiXVIIГераUmbrYoshТомкHearGramSambДрузJameFLC-СодеDeutАртиNigeMargсерт
PatrFrieГусеЧугуФедеРомаKoolКазаВыпуAlexмолнSelaМитрБеркLloyTiruИмпеПогаКраввыпуOmsaCotoучре
ВостCotoNikiClicVentSelaNikiНикиПилаAdioпосвStevАндрИльиустрlounEyviтрагAlexШевчCircоpгаJohn
SideкнигЗакаZoneZoneZoneZone43A1МахоZonediamZoneZoneZoneZoneСероZoneZoneZoneZoneЛеусZoneZone
ZoneустаPlewмесяотблЧепмHansHotpнаклMicrмульPinaКолиTestМ-51КитаProfФилиSTARVOLKфальполоRepr
BravCreaсборMasqMOXIлягумозаJeweTherWindасъеBoscRoweднемBritSTORversЛитРДороЛитРMayaXVIIРома
ЛитРродикривначажизнJameТене(190С-ЯЩСГСкКазатруд1-12StraYestSKINдебютворГастDawnСемиВВинGran
худоАндрредаКазаНикиStevРодиОстрHaroАртешколИванЧерниздаКрыжSpotЧернМаксBarbВыскMariмесямеся
месяМигуAndrавтопредAeroПритDaniавтоБернAlanавточтенubhaВенс
User avatar

vergar
Online

  • Posts: 302676
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: Auto width in divs without enter width

by vergar » Tue Jul 30, 2019 7:53 pm

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingultramaficrockultraviolettesting
User avatar

vergar
Online

  • Posts: 302676
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: Auto width in divs without enter width

by vergar » Wed Aug 07, 2019 4:42 am

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruhttp://semiasphalticflux.ruhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.ruhttp://taskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruhttp://temperateclimate.ruhttp://temperedmeasure.ruhttp://tenementbuilding.ruhttp://ultramaficrock.ruhttp://ultraviolettesting.ru
User avatar

vergar
Online

  • Posts: 302676
  • Joined: Tue Apr 16, 2019 2:34 pm


+ Post a reply

1, 2