Ungawenza njani uMfanekiso kwiCSS3

NguJohn Paul Mueller

Omnye wemibuzo ebuzwa rhoqo malunga neCSS3 yindlela yokubeka umfanekiso kwiphepha. Ngelishwa, uninzi lweempendulo ozifumanayo zixubusha ngoku tag, ngaphandle kokubonisa ukuba ungamisa njani isikhongozeli. Sebenzisa isikhongozeli kubalulekile kuba unokufuna ukongeza ezinye izinto kulo mfanekiso kamva. Le nkqubo ilandelayo ixelela indlela yokubeka umfanekiso.



  1. Vula i-SimpleGraphics.CSS yefayile kwaye wongeze esi sitayile silandelayo.



    #ImageContainer img { height: 400px; width: 400px; margin: 0px; }

    Injongo yolu hlobo kukwenza umfanekiso wobungakanani obuthile. Zininzi iindlela zokujongana nemifanekiso enobungakanani obahlukeneyo. Le yenye yazo. Isebenza kakuhle xa uninzi lwemifanekiso yakho lulingana ngokulingana.

    Ngamanye amaxesha, njengaxa ujolisa imifanekiso yobukhulu obahlukeneyo, kuya kufuneka usebenzise iJavaScript. Ukuze ubeke umfanekiso embindini wephepha, kuya kufuneka ubazi ubungakanani bomfanekiso. Uninzi lweelayibrari zomntu wesithathu zenza kube lula kuwe ukuba ubeke imifanekiso kwiscreen- ubuchule beCSS kuphela bunemida.



  2. Yongeza le khowudi ilandelayo kwisitayile se #ImageContainer.

    position: absolute; height: 400px; width: 400px; left: 50%; margin-left: -205px;

    Le khowudi icwangcisa i

    position ngokupheleleyo kwaye inika ubungakanani obufanayo nomfanekiso, ukuze i iithegi zidityanisiwe. Ke ibeka icala lasekhohlo le-50% kwiphepha liphela, ukuze nokuba umsebenzisi ayitshintshe njani ifestile yebrawuza, icala lasekhohlo liza kuhlala liziko.

    Ewe awufuni ukubeka icala kwicala lasekhohlo le-



    -Ufuna ukubeka umfanekiso ngaphakathi. Ukucwangciswa komda wasekhohlo kushenxisela umda wasekhohlo kwiiphikseli ezingama-205 ngasekhohlo (isiqingatha sobungakanani bomfanekiso wonke, kunye nokuxhonywa), ukuze iziko lomfanekiso ngoku likumbindi wephepha.
  3. Gcina ifayile yeCSS kwaye uphinde ulayishe iphepha.

    Uyawubona umfanekiso kunye nesakhelo esigxile kwiphepha.

    umfanekiso0.jpg