I havechromeopenuponthetopsideofmyscreen, and I haveFirefoxopenonthebottomsideofmyscreen.
Butsomethingimportanttonoteis I have a reallyoldversionofFirefoxbookthen, andthisversionofFirefoxdoesnotsupportpositionssticky.
Soasyoucanseeonthelefthandside, I havesomereallysimplecode.
I justhave a header, whichcontainssometextand a closebuttonwhichshouldbeontherighthandside, asyoucanseeinchromeandthenjust a tonoftextsothatwecanactuallyscrollareheader.
Andbecausepositionstickyisnotsupported, this X doesn't actuallyhave a parenttobepositionedabsoluteinsideofbecausethispositionstickyessentiallydoesnotexistinFirefox.
Andasyoucansee, ifweremoveit, wegetthesamething.
Chrome.
That's whatweneedissomeformoffullbackthatthebrowsercanuseifwe'rein a browserthatdoesnotsupportpositionsticky.
Andbyfartheeasiestwaytodothisisjusttoadd a secondpositionpropertydirectlyabovethepropertythatwewanttooverwriteinmodernbrowsers.
Thereasonthisactuallyworksisbecausewhathappensischromereadsthisheadercodeanditgoesokay, backgroundcolorredpattingone R E M positionrelative, andthenitseespositionsticky, anditoverwritesthispositionrelative.
Buthowdowefixthisissuewithourtextshowingupbehindwell, reallyeasywaytodothatistoforceourheadertobe a specificsizesowecandoisjustremovearepattinginhereandjustsaythatwe'regonnahave a specificheightof, forexample, 50 pixelsjustlikethat.
Andtheninsteadofoursupportproperty, ifweknowthatwedonothavestickypositionsupportandwehavetousefixedthatwejustneedtotellherbodytoe, have a marginonthetoptobeequaltotheheightofourheaderof 50 pixels.
Now, ifwesayweessentiallyhavetheexactsameexperienceinbothourolderbrowseraswellasournewerbrowser, andallwehadtodowas a littlebitofthisfeaturequerymagic.
Butyou'regonnaruninto a problemthatnotallbrowserssupportsthefuture.
Butthewaywehadourcodebefore, if I justrewindthis a littlebitwherewehadthisnotpropertyhereagain, InternetExplorerwouldignoreallofthissoitwouldn't getallofthosefallbackvaluesthatisWhyalmostalwayswhenyou'redealingwiththeatsupportsproperty, youwanttomakeitsothatyouactuallyhaveyourfallbackvaluesofhereinyournormalcodeandtheninyouratsupportsiswhereyou'regonnaprettyputtingallofyourmodernCSSfordoingstickypositionorgridorwhateverelseyouwanttodoinsightofthatcode.