#css gradient border
Explore tagged Tumblr posts
codingflicks · 10 months ago
Text
Tumblr media
CSS Gradient Border
3 notes · View notes
codenewbies · 2 months ago
Text
Tumblr media
Gradient Text Border Animation
1 note · View note
newcodesociety · 1 year ago
Text
0 notes
codingquill · 2 months ago
Text
Tumblr media
Day 1 - 100 Days CSS Challenge
Welcome to day 1 of the 100 Days CSS Challenge! In this challenge, we'll bring a design to life using only CSS. Our goal is to recreate the image we're provided with on the challenge page using HTML and CSS.
On the challenge page, we see:
Tumblr media
A small preview of the design we need to replicate.
A starter HTML template.
A submission form to showcase our work alongside others who have taken on the same challenge.
Let's dive into the process step by step.
Step 1: Screenshot the Image
The first thing I always do is take a screenshot of the target design. Even if the design includes animation, having a static reference helps me focus on the basic structure and colors. Here’s the screenshot of the design we’re aiming for:
Tumblr media
Step 2: Extract the Color Palette
Next, I identify the color palette that we'll need. This helps ensure that we maintain consistency with the original design. Here’s the color palette I’ve created:
Tumblr media
Step 3: Identify and Create the Image Elements in HTML
Now that we know the colors, I break down the elements in the image:
Background: This is a linear gradient.
The 100 number: This is the main challenge, and it will require some work.
Text: “days css challenge,” which we’ll place to the left of the number.
Here’s the HTML structure for these elements:
<div class="frame"> <div class="center"> <div class="number"> <div class="one-one"></div> <div class="one-two"></div> <div class="zero-one"></div> <div class="zero-two"></div> </div> <p class="sentence1">days</p> <p class="sentence2">css challenge</p> </div> </div>
Now that the elements are in place, CSS will bring them to life.
Step 4: Bringing the Elements to Life with CSS
Linear Gradient
To create the background, we’ll use a linear gradient. Here’s a basic syntax:
background: linear-gradient(to <direction>, <color-stop1>, <color-stop2>, ...);
Parameter 1: Direction/Angle
This defines the starting point of the gradient. You can either specify a direction (e.g., to top, to bottom) or an angle (e.g., 90deg, 180deg).
Direction options:
to top
to bottom
to left
to right
If you want more precision, you can specify angles:
0deg: Gradient starts from the top.
90deg: From the right.
180deg: From the bottom.
270deg: From the left.
You can also combine two directions, specifying both horizontal and vertical movements, like to left top or to right bottom. This means:
The first keyword (left or right) controls the horizontal movement.
The second keyword (top or bottom) controls the vertical movement.
For example:
background: linear-gradient(to left top, red, blue);
This gradient starts at the bottom-right corner and transitions toward the top-left.
Parameter 2: Color Stops
Color stops define how the gradient transitions between colors. Each color stop specifies a point where a color starts or ends. Here's an example:
background: linear-gradient(to right, red 10%, blue 90%);
This means:
The element starts at 0% fully red.
By 10%, the transition from red begins.
Between 10% and 90%, there is a smooth blend from red to blue.
At 90%, the transition to blue is complete, and the remaining part is fully blue.
Tumblr media
Once we understand the concept, we can apply the background we need. In our case, the gradient flows from the bottom left to the top right, so the code will look like this:
background: linear-gradient(to right top, #443DA1, #4EC3C9);
Bonus: Stacking Multiple Linear Gradients
You can also apply multiple gradients on top of each other:
background: linear-gradient(180deg, #f00, #0f0), linear-gradient(90deg, #ff0, #f0f);
Step 5: Making the "100" Number
Creating the Zeros
We start with the zeros. These are simply circles created using CSS. To make a full circle, we use border-radius set to 50%.
The white border gives it the appearance of the number zero.
.zero-one, .zero-two { position: absolute; height: 100px; width: 100px; border-radius: 50%; border: 24px solid #fff; box-shadow: 0 0 13px 0 rgba(0,0,0,0.2); }
This gives us a nice circular zero. We adjust their positions using properties like left and top, and manage the z-index to make sure the zeros stack correctly.
.zero-one { z-index: 8; left: 17px; } .zero-two { z-index: 6; left: 100px; }
Tumblr media
Now both zeros are positioned, and they overlap in the way we want.
Creating the "1" Number
The number "1" is made of two div elements:
One-One: This part represents the slanted part of the "1".
One-Two: This is the straight vertical part of the "1".
What make the one-one element slightly slanted is
transform: rotate(50deg);)
the one-two is created simply with a little height and width nothing too particular then it is placed directly on top of the slanted part, giving us the full "1". Its z-index tho has to have a higher value than the slanted part of our 1 to ensure it stays above the slanted one.
Step 6: Adding the Text
For the two sentences “days” and “css challenge,” the styling is basic CSS. You can achieve the look with just a few font changes, some padding, and adjustments to font size. It’s as simple as:
.sentence1,.sentence2{ text-transform: uppercase; margin:0; padding:0; } .sentence1{ font-size:82px; font-weight:700; } .sentence2{ font-size:25px; font-weight:700; margin-top:-20px; }
And just like that, we’ve completed day 1 of the 100 Days CSS Challenge! Each part of the design is carefully crafted using CSS, giving us the final result.
Happy coding, and see you tomorrow for Day 2!
13 notes · View notes
skittlespizza · 5 months ago
Note
hey my bro (mutual) how did you . learn html . like is there a specific guide that helped the most or was it just whatever you could find
HAII OKAY SO these are all my useful site links but sadgrl.online & eggramen.neocities.org will be your best friend!!! Eggramen has a shit ton of templates to choose from & sadgrl.online has a bunch of really useful tutorials!
^ SUPER USEFUL FOR CSS!!! This makes a lot of your css code automatic.
Live coding of html css, i always use this thang...
Also just googling "how to ____ html css" is VERY useful lol. So eggramen and sadgrl to start... LET ME KNOW IF YOU HAVE SPECIFIC QUESTIONS!!! i can also share some of my code if you'd like!!!
12 notes · View notes
freefrontend-blog · 1 year ago
Text
Gradient Border Effect: https://codepen.io/Hyperplexed/pen/LYeLopW More CSS border examples: https://freefrontend.com/css-border-examples/
9 notes · View notes
lazar-codes · 2 years ago
Text
06/06/2023 || Day 31
Frontend Mentor Fylo Landing Page - Log #3
TLDR: The CSS property background: linear-gradient(...) is a lifesaver for having multiple background colours.
Fought for my life today with CSS, and the problem was solved once I was able to phrase my google query in a good-enough way. So here's what I struggled with/learned:
You see this all the time with newer websites; the background colour changes halfway, and there might be some really cool curve that acts as the border (left image), or it can just be a simple even divider (right image). Well... before I managed to get the correct Stack Overflow post I needed, I tried to mess around with the position property for the image on the left. That fancy curve is actually just an image of a curve provided by Frontend Mentor, so I didn't have to worry about that. What I did have to worry about was how/where to place a div that will contain my header stuff before the colour change, and to position the curve in the correct spot. I used position: absolute and somehow made it to work, though I'll be honest, using position: absolute scares me every time. I understand that the idea is that the element with this property is being aligned with respect to the parent element, but it's still scary clicking "save" and seeing all your lovely layout freaking out.
I moved onto the second picture, where I just needed a straight divide between two colours and tried to mess around with divs and position: absolute, but I was getting really mad that nothing was working. Then I got my magical google query to work and discovered this beautiful CSS property and it was all good:
background: linear-gradient(hsl(218, 28%, 13%) 77%, hsl(216, 53%, 9%) 33%) no-repeat;
Tumblr media Tumblr media
The term gradient definitely threw me off because in terms of art, it's that one colour melds/blends into the other, but here there's no blending...? There are probably more arguments for it to make the colours blend...I need to look into that.
So here's an in-progress look at this! I still need to do 2 or 3 more major things for the mobile version, then I'll start working on the desktop version (and getting the details right for both versions)!
11 notes · View notes
kampaproagency · 5 days ago
Text
@import url(https://fonts.bunny.net/css?family=ibm-plex-sans:400,600); #_form_3_font-size:14px;line-height:1.6;font-family:arial, helvetica, sans-serif;margin:0#_form_3_ *outline:0._form_hidedisplay:none;visibility:hidden._form_showdisplay:block;visibility:visible#_form_3_._form-toptop:0#_form_3_._form-bottombottom:0#_form_3_._form-leftleft:0#_form_3_._form-rightright:0#_form_3_ input[type="text"],#_form_3_ input[type="tel"],#_form_3_ input[type="date"],#_form_3_ textareapadding:6px;height:auto;border:#979797 1px solid;border-radius:4px;color:#000000 !important;font-size:14px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box#_form_3_ textarearesize:none#_form_3_ ._submit-webkit-appearance:none;cursor:pointer;font-family:arial, sans-serif;font-size:14px;text-align:center;background:#004CFF !important;border:0 !important;-moz-border-radius:4px !important;-webkit-border-radius:4px !important;border-radius:4px !important;color:#FFFFFF !important;padding:10px !important#_form_3_ ._submit:disabledcursor:not-allowed;opacity:0.4#_form_3_ ._submit.processingposition:relative#_form_3_ ._submit.processing::beforecontent:"";width:1em;height:1em;position:absolute;z-index:1;top:50%;left:50%;border:double 3px transparent;border-radius:50%;background-image:linear-gradient(#004CFF, #004CFF), conic-gradient(#004CFF, #FFFFFF);background-origin:border-box;background-clip:content-box, border-box;animation:1200ms ease 0s infinite normal none running _spin#_form_3_ ._submit.processing::aftercontent:"";position:absolute;top:0;bottom:0;left:0;right:0;background:#004CFF !important;border:0 !important;-moz-border-radius:4px !important;-webkit-border-radius:4px !important;border-radius:4px !important;color:#FFFFFF !important;padding:10px !important@keyframes _spin0%transform:translate(-50%, -50%) rotate(90deg)100%transform:translate(-50%, -50%) rotate(450deg)#_form_3_ ._close-iconcursor:pointer;background-image:url("https://d226aj4ao1t61q.cloudfront.net/esfkyjh1u_forms-close-dark.png");background-repeat:no-repeat;background-size:14.2px 14.2px;position:absolute;display:block;top:11px;right:9px;overflow:hidden;width:16.2px;height:16.2px#_form_3_ ._close-icon:beforeposition:relative#_form_3_ ._form-bodymargin-bottom:30px#_form_3_ ._form-image-leftwidth:150px;float:left#_form_3_ ._form-content-rightmargin-left:164px#_form_3_ ._form-brandingcolor:#fff;font-size:10px;clear:both;text-align:left;margin-top:30px;font-weight:100#_form_3_ ._form-branding ._logodisplay:block;width:130px;height:14px;margin-top:6px;background-image:url("https://d226aj4ao1t61q.cloudfront.net/hh9ujqgv5_aclogo_li.png");background-size:130px auto;background-repeat:no-repeat#_form_3_ .form-sr-onlyposition:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0#_form_3_ ._form-label,#_form_3_ ._form_element ._form-labelfont-weight:bold;margin-bottom:5px;display:block#_form_3_._dark ._form-brandingcolor:#333#_form_3_._dark ._form-branding ._logobackground-image:url("https://d226aj4ao1t61q.cloudfront.net/jftq2c8s_aclogo_dk.png")#_form_3_ ._form_elementposition:relative;margin-bottom:10px;font-size:0;max-width:100%#_form_3_ ._form_element *font-size:14px#_form_3_ ._form_element._clearclear:both;width:100%;float:none#_form_3_ ._form_element._clear:afterclear:left#_form_3_ ._form_element input[type="text"],#_form_3_ ._form_element input[type="date"],#_form_3_ ._form_element select,#_form_3_ ._form_element textarea:not(.g-recaptcha-response)display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:inherit#_form_3_ ._field-wrapperposition:relative#_form_3_ ._inline-stylefloat:left#_form_3_ ._inline-style input[type="text"]width:150px#_form_3_ ._inline-style:not(._clear)+._inline-style:not(._clear)margin-left:20px#_form_3_ ._form_element img._form-imagemax-width:100%#_form_3_ ._form_element ._form-fieldsetborder:0;padding:0.01em 0 0 0;margin:0;min-width:0#_form_3_ ._clear-elementclear:left#_form_3_ .
_full_widthwidth:100%#_form_3_ ._form_full_fielddisplay:block;width:100%;margin-bottom:10px#_form_3_ input[type="text"]._has_error,#_form_3_ textarea._has_errorborder:#F37C7B 1px solid#_form_3_ input[type="checkbox"]._has_erroroutline:#F37C7B 1px solid#_form_3_ ._errordisplay:block;position:absolute;font-size:14px;z-index:10000001#_form_3_ ._error._abovepadding-bottom:4px;bottom:39px;right:0#_form_3_ ._error._belowpadding-top:8px;top:100%;right:0#_form_3_ ._error._above ._error-arrowbottom:-4px;right:15px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #FFDDDD#_form_3_ ._error._below ._error-arrowtop:0;right:15px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #FFDDDD#_form_3_ ._error-innerpadding:12px 12px 12px 36px;background-color:#FFDDDD;background-image:url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM9 3V9H7V3H9ZM9 13V11H7V13H9Z' fill='%23CA0000'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:12px center;font-size:14px;font-family:arial, sans-serif;font-weight:600;line-height:16px;color:#000;text-align:center;text-decoration:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;box-shadow:0px 1px 4px rgba(31, 33, 41, 0.298295)@media only screen and (max-width:319px)#_form_3_ ._error-innerpadding:7px 7px 7px 25px;font-size:12px;line-height:12px;background-position:4px center;max-width:100px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis#_form_3_ ._error-inner._form_errormargin-bottom:5px;text-align:left#_form_3_ ._button-wrapper ._error-inner._form_errorposition:static#_form_3_ ._error-inner._no_arrowmargin-bottom:10px#_form_3_ ._error-arrowposition:absolute;width:0;height:0#_form_3_ ._error-htmlmargin-bottom:10px.pika-singlez-index:10000001 !important#_form_3_ input[type="text"].datetime_datewidth:69%;display:inline#_form_3_ select.datetime_timewidth:29%;display:inline;height:32px#_form_3_ input[type="date"].datetime_datewidth:69%;display:inline-flex#_form_3_ input[type="time"].datetime_timewidth:29%;display:inline-flex@media (min-width:320px) and (max-width:667px)::-webkit-scrollbardisplay:none#_form_3_margin:0;width:100%;min-width:100%;max-width:100%;box-sizing:border-box#_form_3_ *-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:1em#_form_3_ ._form-contentmargin:0;width:100%#_form_3_ ._form-innerdisplay:block;min-width:100%#_form_3_ ._form-title,#_form_3_ ._inline-stylemargin-top:0;margin-right:0;margin-left:0#_form_3_ ._form-titlefont-size:1.2em#_form_3_ ._form_elementmargin:0 0 20px;padding:0;width:100%#_form_3_ ._form-element,#_form_3_ ._inline-style,#_form_3_ input[type="text"],#_form_3_ label,#_form_3_ p,#_form_3_ textarea:not(.g-recaptcha-response)float:none;display:block;width:100%#_form_3_ ._row._checkbox-radio labeldisplay:inline#_form_3_ ._row,#_form_3_ p,#_form_3_ labelmargin-bottom:0.7em;width:100%#_form_3_ ._row input[type="checkbox"],#_form_3_ ._row input[type="radio"]margin:0 !important;vertical-align:middle !important#_form_3_ ._row input[type="checkbox"]+span labeldisplay:inline#_form_3_ ._row span labelmargin:0 !important;width:initial !important;vertical-align:middle !important#_form_3_ ._form-imagemax-width:100%;height:auto !important#_form_3_ input[type="text"]padding-left:10px;padding-right:10px;font-size:16px;line-height:1.3em;-webkit-appearance:none#_form_3_ input[type="radio"],#_form_3_ input[type="checkbox"]display:inline-block;width:1.3em;height:1.3em;font-size:1em;margin:0 0.3em 0 0;vertical-align:baseline#_form_3_ button[type="submit"]padding:20px;font-size:1.5em#_form_3_ ._inline-stylemargin:20px 0 0 !important#_form_3_ .sms_consent_checkboxoverflow:auto#_form_3_ .sms_consent_checkbox input[type="checkbox"]float:left;margin:5px 10px 10px 0#_form_3_ .
sms_consent_checkbox .sms_consent_messagedisplay:inline;width:95%;float:left;text-align:left;margin-bottom:10px#_form_3_ .sms_consent_checkbox .sms_consent_message.sms_consent_miniwidth:90%#_form_3_position:relative;text-align:left;margin:25px auto 0;padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#FFFFFF !important;border:0px solid #B0B0B0 !important;max-width:500px;-moz-border-radius:0px !important;-webkit-border-radius:0px !important;border-radius:0px !important;color:#000000#_form_3_._inline-form,#_form_3_._inline-form ._form-contentfont-family:"IBM Plex Sans", Helvetica, sans-serif#_form_3_._inline-form ._row span,#_form_3_._inline-form ._row labelfont-family:"IBM Plex Sans", Helvetica, sans-serif;font-size:14px;font-weight:400;line-height:1.6em#_form_3__inlineform input[type="text"],#_form_3__inlineform input[type="date"],#_form_3__inlineform input[type="tel"],#_form_3__inlineform select,#_form_3__inlineform textarea:not(.g-recaptcha-response)font-family:"IBM Plex Sans", Helvetica, sans-serif;font-size:14px;font-weight:400;font-color:#000000;line-height:1.6em#_form_3_._inline-form ._html-code *:not(h1, h2, h3, h4, h5, h6),#_form_3_._inline-form ._form-thank-youfont-family:"IBM Plex Sans", Helvetica, sans-serif#_form_3_._inline-form ._form-label,#_form_3_._inline-form ._form-emailidentifier,#_form_3_._inline-form ._form-checkbox-option-labelfont-family:"IBM Plex Sans", Helvetica, sans-serif;font-size:14px;font-weight:700;line-height:1.6em#_form_3_._inline-form ._submitmargin-top:12px;font-family:"IBM Plex Sans", Helvetica, sans-serif#_form_3_._inline-form ._html-code h1,#_form_3_._inline-form ._html-code h2,#_form_3_._inline-form ._html-code h3,#_form_3_._inline-form ._html-code h4,#_form_3_._inline-form ._html-code h5,#_form_3_._inline-form ._html-code h6,#_form_3_._inline-form ._form-titlefont-size:22px;line-height:normal;font-weight:600;margin-bottom:0#_form_3_._inline-form ._form-brandingfont-family:"IBM Plex Sans", Helvetica, sans-serif;font-size:13px;font-weight:100;font-style:normal;text-decoration:none#_form_3_:before,#_form_3_:aftercontent:" ";display:table#_form_3_:afterclear:both#_form_3_._inline-stylewidth:auto;display:inline-block#_form_3_._inline-style input[type="text"],#_form_3_._inline-style input[type="date"]padding:10px 12px#_form_3_._inline-style button._inline-styleposition:relative;top:27px#_form_3_._inline-style pmargin:0#_form_3_._inline-style ._button-wrapperposition:relative;margin:16px 12.5px 0 20px#_form_3_ ._form-thank-youposition:relative;left:0;right:0;text-align:center;font-size:18px#_form_3_ ._form-pc-confirmation ._submitmargin-top:16px@media (min-width:320px) and (max-width:667px)#_form_3_._inline-form._inline-style ._inline-style._button-wrappermargin-top:20px !important;margin-left:0 !important#_form_3_ .iti.iti--allow-dropdown.iti--separate-dial-codewidth:100%#_form_3_ .iti inputwidth:100%;height:32px;border:#979797 1px solid;border-radius:4px#_form_3_ .iti--separate-dial-code .iti__selected-flagbackground-color:#FFFFFF;border-radius:4px#_form_3_ .iti--separate-dial-code .iti__selected-flag:hoverbackground-color:rgba(0, 0, 0, 0.05)#_form_3_ .iti__country-listborder-radius:4px;margin-top:4px;min-width:460px#_form_3_ .iti__country-list--dropupmargin-bottom:4px#_form_3_ .phone-error-hiddendisplay:none#_form_3_ .phone-errorcolor:#E40E49#_form_3_ .phone-input-errorborder:1px solid #E40E49 !important#_form_3_._inline-form ._form-content ._form-list-subscriptions-field fieldsetmargin:0;margin-bottom:1.1428571429em;border:none;padding:0#_form_3_._inline-form ._form-content ._form-list-subscriptions-field fieldset:last-childmargin-bottom:0#_form_3_._inline-form ._form-content ._form-list-subscriptions-field legendmargin-bottom:1.1428571429em#_form_3_._inline-form ._form-content ._form-list-subscriptions-field labeldisplay:flex;align-items:flex-start;justify-content:flex-start;margin-bottom:0.
8571428571em#_form_3_._inline-form ._form-content ._form-list-subscriptions-field label:last-childmargin-bottom:0#_form_3_._inline-form ._form-content ._form-list-subscriptions-field inputmargin:0;margin-right:8px#_form_3_._inline-form ._form-content ._form-list-subscriptions-field ._form-checkbox-option-labeldisplay:block;font-weight:400;margin-top:-4px#_form_3_._inline-form ._form-content ._form-list-subscriptions-field ._form-checkbox-option-label-with-descriptiondisplay:block;font-weight:700;margin-top:-4px#_form_3_._inline-form ._form-content ._form-list-subscriptions-field ._form-checkbox-option-descriptionmargin:0;font-size:0.8571428571em#_form_3_._inline-form ._form-content ._form-list-subscriptions-field ._form-subscriptions-unsubscribe-all-descriptionline-height:normal;margin-top:-2px Cuenta* Correo electrónico* Número de empleados 45658 26 - 50 51 - 100 101 - 500 501 - 1000 Más de 1000 Ingresos anuales Menos de 100.000 100.000 - 500.000 501.000 - 1M 1M - 5M 6M - 10M Más de 10.000 Industrial/Vertical Contabilidad/Financiero Consultoría/Agencia Bloguero/Autor E-commerce/ventas al por menor Entretenimiento/Eventos Fitness/Nutrición Cuidado sanitario Medios/Publicidad Sin ánimo de lucro Formaciones online/Educación Mercado inmobiliario Software Viajes/Hospitalidad Otro ¿Cuál es tu nivel de ingresos? De 0 a 500 euros De 501 a 1.000 euros Más de 1.000 euros Enviar window.cfields = []; window._show_thank_you = function(id, message, trackcmp_url, email) var form = document.getElementById('_form_' + id + '_'), thank_you = form.querySelector('._form-thank-you'); form.querySelector('._form-content').style.display = 'none'; thank_you.innerHTML = message; thank_you.style.display = 'block'; const vgoAlias = typeof visitorGlobalObjectAlias === 'undefined' ? 'vgo' : visitorGlobalObjectAlias; var visitorObject = window[vgoAlias]; if (email && typeof visitorObject !== 'undefined') visitorObject('setEmail', email); visitorObject('update'); else if (typeof(trackcmp_url) != 'undefined' && trackcmp_url) // Site tracking URL to use after inline form submission. _load_script(trackcmp_url); if (typeof window._form_callback !== 'undefined') window._form_callback(id);
; window._show_unsubscribe = function(id, message, trackcmp_url, email) var form = document.getElementById('_form_' + id + '_'), unsub = form.querySelector('._form-thank-you'); var branding = form.querySelector('._form-branding'); if (branding) branding.style.display = 'none'; form.querySelector('._form-content').style.display = 'none'; unsub.style.display = 'block'; form.insertAdjacentHTML('afterend', message) const vgoAlias = typeof visitorGlobalObjectAlias === 'undefined' ? 'vgo' : visitorGlobalObjectAlias; var visitorObject = window[vgoAlias]; if (email && typeof visitorObject !== 'undefined') visitorObject('setEmail', email); visitorObject('update'); else if (typeof(trackcmp_url) != 'undefined' && trackcmp_url) // Site tracking URL to use after inline form submission. _load_script(trackcmp_url); if (typeof window._form_callback !== 'undefined') window._form_callback(id); ; window._show_error = function(id, message, html) var form = document.getElementById('_form_' + id + '_'), err = document.createElement('div'), button = form.querySelector('button'), old_error = form.querySelector('._form_error'); if (old_error) old_error.parentNode.removeChild(old_error); err.innerHTML = message; err.className = '_error-inner _form_error _no_arrow'; var wrapper = document.createElement('div'); wrapper.className = '_form-inner'; wrapper.appendChild(err); button.parentNode.insertBefore(wrapper, button); var submitButton = form.querySelector('[id^="_form"][id$="_submit"]'); submitButton.disabled = false; submitButton.classList.remove('processing'); if (html) var div = document.createElement('div'); div.className = '_error-html'; div.innerHTML = html; err.appendChild(div); ; window._show_pc_confirmation = function(id, header, detail, show, email) var form = document.getElementById('_form_' + id + '_'), pc_confirmation = form.querySelector('._form-pc-confirmation'); if (pc_confirmation.style.display === 'none') form.querySelector('._form-content').style.display = 'none'; pc_confirmation.innerHTML = "" + header + "" + "" + detail + "" + "Administrar preferencias"; pc_confirmation.style.display = 'block'; var mp = document.querySelector('input[name="mp"]'); mp.value = '0'; else form.querySelector('._form-content').style.display = 'inline'; pc_confirmation.style.display = 'none'; var hideButton = document.getElementById('hideButton'); // Add event listener to the button hideButton.addEventListener('click', function() var submitButton = document.querySelector('#_form_3_submit'); submitButton.disabled = false; submitButton.classList.remove('processing'); var mp = document.querySelector('input[name="mp"]'); mp.value = '1'; const cacheBuster = new URL(window.location.href); cacheBuster.searchParams.set('v', new Date().getTime()); window.location.href = cacheBuster.toString(); ); const vgoAlias = typeof visitorGlobalObjectAlias === 'undefined' ? 'vgo' : visitorGlobalObjectAlias; var visitorObject = window[vgoAlias]; if (email && typeof visitorObject !== 'undefined') visitorObject('setEmail', email); visitorObject('update'); else if (typeof(trackcmp_url) != 'undefined' && trackcmp_url) // Site tracking URL to use after inline form submission. _load_script(trackcmp_url); if (typeof window._form_callback !== 'undefined') window._form_callback(id); ; window._load_script = function(url, callback, isSubmit) var head = document.querySelector('head'), script = document.createElement('script'), r = false; var submitButton = document.querySelector('#_form_3_submit'); script.charset = 'utf-8'; script.src = url; if (callback)
script.onload = script.onreadystatechange = function() this.readyState == 'complete')) r = true; callback(); ; script.onerror = function() if (isSubmit) if (script.src.length > 10000) _show_error("3", "Lo sentimos, ocurrió un error con el envío. Acorta tus respuestas y vuelve a intentarlo."); else _show_error("3", "Lo sentimos, ocurrió un error con el envío. Vuelve a intentarlo."); submitButton.disabled = false; submitButton.classList.remove('processing'); head.appendChild(script); ; (function() if (window.location.search.search("excludeform") !== -1) return false; var getCookie = function(name) var match = document.cookie.match(new RegExp('(^ var setCookie = function(name, value) var now = new Date(); var time = now.getTime(); var expireTime = time + 1000 * 60 * 60 * 24 * 365; now.setTime(expireTime); document.cookie = name + '=' + value + '; expires=' + now + ';path=/; Secure; SameSite=Lax;'; var addEvent = function(element, event, func) if (element.addEventListener) element.addEventListener(event, func); else var oldFunc = element['on' + event]; element['on' + event] = function() oldFunc.apply(this, arguments); func.apply(this, arguments); ; var _removed = false; var form_to_submit = document.getElementById('_form_3_'); var allInputs = form_to_submit.querySelectorAll('input, select, textarea'), tooltips = [], submitted = false; var getUrlParam = function(name) if (name.toLowerCase() !== 'email') false; // email is a special case because a plus is valid in the email address var qString = window.location.search; if (!qString) return false; var parameters = qString.substr(1).split('&'); for (var i = 0; i < parameters.length; i++) var parameter = parameters[i].split('='); if (parameter[0].toLowerCase() === 'email') return parameter[1] === undefined ? true : decodeURIComponent(parameter[1]); return false; ; var acctDateFormat = "%m/%d/%Y"; var getNormalizedDate = function(date, acctFormat) %e).*%m/gi) !== null) return decodedDate.replace(/(\d2).*(\d2).*(\d4)/g, '$3-$2-$1'); else if (Date.parse(decodedDate)) var dateObj = new Date(decodedDate); var year = dateObj.getFullYear(); var month = dateObj.getMonth() + 1; var day = dateObj.getDate(); return `$year-$month < 10 ? `0$month` : month-$day < 10 ? `0$day` : day`; return false; ; var getNormalizedTime = function(time) var hour, minutes; var decodedTime = decodeURIComponent(time); var timeParts = Array.from(decodedTime.matchAll(/(\d1,2):(\d1,2)\W*([AaPp][Mm])?/gm))[0]; if (timeParts[3]) // 12 hour format var isPM = timeParts[3].toLowerCase() === 'pm'; if (isPM) hour = parseInt(timeParts[1]) === 12 ? '12' : `$parseInt(timeParts[1]) + 12`; else hour = parseInt(timeParts[1]) === 12 ? '0' : timeParts[1]; else // 24 hour format hour = timeParts[1]; var normalizedHour = parseInt(hour) < 10 ? `0$parseInt(hour)` : hour; var minutes = timeParts[2]; return `$normalizedHour:$minutes`; ; for (var i = 0; i < allInputs.length; i++) var regexStr = "field\\[(\\d+)\\]"; var results = new RegExp(regexStr).exec(allInputs[i].name); if (results != undefined) allInputs[i].dataset.name = allInputs[i].name.match(/\[time\]$/)
? `$window.cfields[results[1]]_time` : window.cfields[results[1]]; else allInputs[i].dataset.name = allInputs[i].name; var fieldVal = getUrlParam(allInputs[i].dataset.name); if (fieldVal) var remove_tooltips = function() for (var i = 0; i < tooltips.length; i++) tooltips[i].tip.parentNode.removeChild(tooltips[i].tip); tooltips = []; ; var remove_tooltip = function(elem) for (var i = 0; i < tooltips.length; i++) if (tooltips[i].elem === elem) tooltips[i].tip.parentNode.removeChild(tooltips[i].tip); tooltips.splice(i, 1); return; ; var create_tooltip = function(elem, text) var tooltip = document.createElement('div'), arrow = document.createElement('div'), inner = document.createElement('div'), new_tooltip = ; if (elem.type != 'radio' && elem.type != 'checkbox') tooltip.className = '_error'; arrow.className = '_error-arrow'; inner.className = '_error-inner'; inner.innerHTML = text; tooltip.appendChild(arrow); tooltip.appendChild(inner); elem.parentNode.appendChild(tooltip); else tooltip.className = '_error-inner _no_arrow'; tooltip.innerHTML = text; elem.parentNode.insertBefore(tooltip, elem); new_tooltip.no_arrow = true; new_tooltip.tip = tooltip; new_tooltip.elem = elem; tooltips.push(new_tooltip); return new_tooltip; ; var resize_tooltip = function(tooltip) ; var resize_tooltips = function() if (_removed) return; for (var i = 0; i < tooltips.length; i++) if (!tooltips[i].no_arrow) resize_tooltip(tooltips[i]); ; var validate_field = function(elem, remove) ; var needs_validate = function(el) if(el.getAttribute('required') !== null) return true if(el.name === 'email' && el.value !== "") return true if((el.id == 'field[]' ; var validate_form = function(e) var err = form_to_submit.querySelector('._form_error'), no_error = true; if (!submitted) submitted = true; for (var i = 0, len = allInputs.length; i < len; i++) var input = allInputs[i]; if (needs_validate(input)) input.type == 'time') addEvent(input, 'blur', function() this.value = this.value.trim(); validate_field(this, true); ); addEvent(input, 'input', function() validate_field(this, true); ); else if (input.type == 'radio' remove_tooltips(); for (var i = 0, len = allInputs.length; i < len; i++) var elem = allInputs[i]; if (needs_validate(elem)) if (elem.tagName.toLowerCase() !== "select") elem.value = elem.value.trim(); validate_field(elem) ? true : no_error = false; if (!no_error && e) e.preventDefault(); resize_tooltips(); return no_error; ; addEvent(window, 'resize', resize_tooltips); addEvent(window, 'scroll', resize_tooltips); var hidePhoneInputError = function(inputId) var errorMessage = document.getElementById("error-msg-" + inputId); var input = document.getElementById(inputId); errorMessage.classList.remove("phone-error"); errorMessage.classList.add("phone-error-hidden"); input.classList.remove("phone-input-error"); ; var initializePhoneInput = function(input, defaultCountry)
return window.intlTelInput(input, utilsScript: "https://unpkg.com/[email protected]/build/js/utils.js", autoHideDialCode: false, separateDialCode: true, initialCountry: defaultCountry, preferredCountries: [] ); var setPhoneInputEventListeners = function(inputId, input, iti) input.addEventListener('blur', function() var errorMessage = document.getElementById("error-msg-" + inputId); if (input.value.trim()) if (iti.isValidNumber()) iti.setNumber(iti.getNumber()); if (errorMessage.classList.contains("phone-error")) hidePhoneInputError(inputId); else showPhoneInputError(inputId) else if (errorMessage.classList.contains("phone-error")) hidePhoneInputError(inputId); ); input.addEventListener("countrychange", function() iti.setNumber(''); ); input.addEventListener("keydown", function(e) var charCode = (e.which) ? e.which : e.keyCode; if (charCode > 31 && (charCode < 48 ); ; var showPhoneInputError = function(inputId) var errorMessage = document.getElementById("error-msg-" + inputId); var input = document.getElementById(inputId); errorMessage.classList.add("phone-error"); errorMessage.classList.remove("phone-error-hidden"); input.classList.add("phone-input-error"); ; var _form_serialize = function(form); const formSupportsPost = false; var form_submit = function(e) e.preventDefault(); if (validate_form()) // use this trick to get the submit button & disable it using plain javascript var submitButton = e.target.querySelector('#_form_3_submit'); submitButton.disabled = true; submitButton.classList.add('processing'); var serialized = _form_serialize( document.getElementById('_form_3_') ).replace(/%0A/g, '\\n'); var err = form_to_submit.querySelector('._form_error'); err ? err.parentNode.removeChild(err) : false; async function submitForm() var formData = new FormData(); const searchParams = new URLSearchParams(serialized); searchParams.forEach((value, key) => if (key !== 'hideButton') formData.append(key, value); //formData.append(key, value); ); let request = headers: "Accept": "application/json" , body: formData, method: "POST" ; let pageUrlParams = new URLSearchParams(window.location.search); if (pageUrlParams.has('t')) request.headers.Authorization = 'Bearer ' + pageUrlParams.get('t'); const response = await fetch('https://kampa5569.activehosted.com/proc.php?jsonp=true', request); return response.json(); if (formSupportsPost) submitForm().then((data) => eval(data.js); ); else _load_script('https://kampa5569.activehosted.com/proc.php?' + serialized + '&jsonp=true', null, true); return false; ; addEvent(form_to_submit, 'submit', form_submit); )();
0 notes
posetimalatiblog · 3 years ago
Text
About Us
New Post has been published on https://www.yalcinpakambalaj.com/en/about-us/
About Us
[vc_row gap=”40″ equal_height=”yes” content_placement=”top” element_id=”394976″ element_css=”.vc-row-331899 .animated-container background-image:url(https://www.yalcinpakambalaj.com/wp-content/uploads/2018/12/map_transparent_dark.png);.vc-row-331899 .top-gradient background:linear-gradient(to bottom, #ffd311 0%,rgba(255,255,255,0) 100%);.vc-row-331899 .bottom-gradient background:linear-gradient(to top, #ffd311 0%,rgba(255,255,255,0) 100%);” css=”.vc_custom_1643195299446padding-top: 56px !important;padding-bottom: 96px !important;” el_id=”one-page-about-us”][vc_column animation_delay=”0″ css_animation=”top-to-bottom” element_id=”879094″ crp=”480:i:i,480-768:i:i,768-1024:i:i,1024-1280:15:15,1280-1366:i:i,1366-1600:i:i,1600-1920:i:i” offset=”vc_col-lg-6 vc_col-md-12 vc_col-xs-12″ css=”.vc_custom_1643195007817margin-top: 0px !important;”]
[/vc_column][vc_column animation_delay=”150″ css_animation=”top-to-bottom” element_id=”504275″ crp=”480:i:i,480-768:i:i,768-1024:i:i,1024-1280:15:15,1280-1366:i:i,1366-1600:i:i,1600-1920:i:i” offset=”vc_col-lg-6 vc_col-md-12 vc_col-xs-12″]
Yalçın Pak Packaging
[vc_column_text animation_delay=”0″]As Yalçın Pak Packaging, it is one of the leading companies in its sector, working to offer the best for you in line with its flawless policy and unlimited service understanding, which has been working with a customer-focused approach to important projects since 1985. Leading without borders in quality and service, Yalçın Pak Ambalaj, which is in continuous development in the Bag & Packaging sector, works to make a difference for you…
Our Mission
Yalçın Pak Packaging is our mission; With its institutionalized identity, it is to be the most desired company to work with, acting in the direction of continuous improvement of our environmental and occupational health and safety performance, by reflecting all kinds of dynamic technological developments and innovations to all production.
Our Vision
Our aim is to provide the best quality service to our customers without any problems, with unlimited development and professional quality, by advancing with great steps every day within Yalçın Pak Packaging. Without sacrificing quality in the sector, we are building your dreams with our unlimited employees…
Our Customer Policy
We are aware that the most important element of making a difference is to provide high level customer satisfaction by providing quality services to our customers. With this awareness, while we are building your living spaces for our customers, we are working for your trust and peace by building the customer policy of Yalçın Pak Packaging. In this direction, YOU are our values. Our values ​​tell us about us.[/vc_column_text][/vc_column][/vc_row]
0 notes
cssscriptcom · 1 month ago
Text
10+ Stunning Border Styles For UI/UX Design - Bordex.js
Bordex is a JavaScript library that adds customizable border styles to HTML elements. This library minimizes the need to write custom CSS for border styling. Users can apply complex border effects by calling specific functions with customizable parameters. Border Styles Included: Blur Corner Disjointed Fancy Gradient Inset Overlap Stripe Thin Generic How to use it: 1. Install & download. npm…
1 note · View note
kandztuts · 1 month ago
Text
CSS 5 💻 background related properties
New Post has been published on https://tuts.kandz.me/css-5-%f0%9f%92%bb-background-related-properties/
CSS 5 💻 background related properties
Tumblr media
youtube
In CSS there are several properties to customise one element's background background-color → sets the color behind the content of the element. it can accept color keywords like "blue", hexadecimal codes, rgb/rba and... hsl/hsla values and also gradients backgrounds. it sets the background color to red background-image → sets the background for an element to an image. It also accepts gradients it sets the backround to a linear gradient background-repeat → specifies how a background image will be repeated You can use repeat, no-repeat, repeat-x, repeat-y, space, round It sets the background to an image It sets to repeat the background image background-position → sets the position relative to its container you can set one or two values for horizontal and vertical positioning you can use left, right, top, bottom, center, and of course % percentage values it sets the background position center horizontally and top vertically background-attachment → specifies whether the image will scroll with the content you can use fixed, local, scroll, initial or inherit It sets the background image to fixed, it will not scroll with the page background-clip → specifies the clipping region of the background... border-box is the default value and extends to the border... padding-box extends to the inside of the border... and content-box extends to the content box It sets the background image to extend to the inside of the border background-origin → sets the positioning of the origin point. Values: border-box sets the origin to upper left corner of the border... padding-box sets the origin to upper left corner of padding edge... content-box sets the origin to upper left corner of the content... it sets sets the origin to the upper left corner of the border background-size → controls the scaling of the background image you can use %, px values. Also auto → original size cover → image is resized to fully fills the container, contain → is resized to be fully visible
0 notes
codingflicks · 1 year ago
Text
Tumblr media
CSS Gradient Border Animation
0 notes
codenewbies · 7 months ago
Text
Tumblr media
CSS Gradient Border Animation
1 note · View note
jcmarchi · 3 months ago
Text
How to Make a “Scroll to Select” Form Control
New Post has been published on https://thedigitalinsider.com/how-to-make-a-scroll-to-select-form-control/
How to Make a “Scroll to Select” Form Control
The <select> element is a fairly straightforward concept: focus on it to reveal a set of <option>s that can be selected as the input’s value. That’s a great pattern and I’m not suggesting we change it. That said, I do enjoy poking at things and found an interesting way to turn a <select> into a dial of sorts — where options are selected by scrolling them into position, not totally unlike a combination lock or iOS date pickers. Anyone who’s expanded a <select> for selecting a country knows how painfully long lists can be and this could be one way to prevent that.
Here’s what I’m talking about:
It’s fairly common knowledge that styling <select> in CSS is not the easiest thing in the world. But here’s the trick: we’re not working with <select> at all. No, we’re not going to do anything like building our own <select> by jamming a bunch of JavaScript into a <div>. We’re still working with semantic form controls, only it’s radio buttons.
<section class=scroll-container> <label for="madrid" class="scroll-item"> Madrid <abbr>MAD</abbr> <input id="madrid" type="radio" name="items"> </label> <label for="malta" class="scroll-item"> Malta <abbr>MLA</abbr> <input id="malta" type="radio" name="items"> </label> <!-- etc. --> </section>
What we need is to style the list of selectable controls where we are capable of managing their sizes and spacing in CSS. I’ve gone with a group of labels with nested radio boxes as far as the markup goes. The exact styling is totally up to you, of course, but you can use these base styles I wrote up if you want a starting point.
.scroll-container /* SIZING & LAYOUT */ --itemHeight: 60px; --itemGap: 10px; --containerHeight: calc((var(--itemHeight) * 7) + (var(--itemGap) * 6)); width: 400px; height: var(--containerHeight); align-items: center; row-gap: var(--itemGap); border-radius: 4px; /* PAINT */ --topBit: calc((var(--containerHeight) - var(--itemHeight))/2); --footBit: calc((var(--containerHeight) + var(--itemHeight))/2); background: linear-gradient( rgb(254 251 240), rgb(254 251 240) var(--topBit), rgb(229 50 34 / .5) var(--topBit), rgb(229 50 34 / .5) var(--footBit), rgb(254 251 240) var(--footBit)); box-shadow: 0 0 10px #eee;
A couple of details on this:
--itemHeight is the height of each item in the list.
--itemGap is meant to be the space between two items.
The --containerHeight variable is the .scroll-container’s height. It’s the sum of the item sizes and the gaps between them, ensuring that we display, at maximum, seven items at once. (An odd number of items gives us a nice balance where the selected item is directly in the vertical center of the list). 
The background is a striped gradient that highlights the middle area, i.e., the location of the currently selected item. 
 The --topBit and –-footBit variables are color stops that visually paint in the middle area (which is orange in the demo) to represent the currently selected item.
I’ll arrange the controls in a vertical column with flexbox declared on the .scroll-container:
.scroll-container display: flex; flex-direction: column; /* rest of styles */
With layout work done, we can focus on the scrolling part of this. If you haven’t worked with CSS Scroll Snapping before, it’s a convenient way to direct a container’s scrolling behavior. For example, we can tell the .scroll-container that we want to enable scrolling in the vertical direction. That way, it’s possible to scroll to the rest of the items that are not in view.
.scroll-container overflow-y: scroll; /* rest of styles */
Next, we reach for the scroll-snap-style property that can be used to tell the .scroll-container that we want scrolling to stop on an item — not near an item, but directly on it.
.scroll-container overflow-y: scroll; scroll-snap-type: y mandatory; /* rest of styles */
Now items “snap” onto an item instead of allowing a scroll to end wherever it wants. One more little detail I like to include is overscroll-behavior, specifically along the y-axis as far as this demo goes:
.scroll-container overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior-y: none; /* rest of styles */
overscroll-behavior-y: none isn’t required to make this work, but when someone scrolls through the .scroll-container (along the y-axis), scrolling stops once the boundary is reached, and any further continued scrolling action will not trigger scrolling in any nearby scroll containers. Just a form of defensive CSS.
Time to move to the items inside the scroll container. But before we go there, here are some base styles for the items themselves that you can use as a starting point:
.scroll-item /* SIZING & LAYOUT */ width: 90%; box-sizing: border-box; padding-inline: 20px; border-radius: inherit; /* PAINT & FONT */ background: linear-gradient(to right, rgb(242 194 66), rgb(235 122 51)); box-shadow: 0 0 4px rgb(235 122 51); font: 16pt/var(--itemHeight) system-ui; color: #fff; input appearance: none; abbr float: right; /* The airport code */
As I mentioned earlier, the --itemHeight variable is setting as the size of each item and we’re declaring it on the flex property — flex: 0 0 var(--itemHeight). Margin is added before and after the first and last items, respectively, so that every item can reach the middle of the container through scrolling. 
The scroll-snap-align property is there to give the .scroll-container a snap point for the items. A center alignment, for instance, snaps an item’s center (vertical center, in this case) with the .scroll-container‘s center (vertical center as well). Since the items are meant to be selected through scrolling alone pointer-events: none is added to prevent selection from clicks.
One last little styling detail is to set a new background on an item when it is in a :checked state:
.scroll-item /* Same styles as before */ /* If input="radio" is :checked */ &:has(:checked) background: rgb(229 50 34);
But wait! You’re probably wondering how in the world an item can be :checked when we’re removing pointer-events. Good question! We’re all finished with styling, so let’s move on to figuring some way to “select” an item purely through scrolling. In other words, whatever item scrolls into view and “snaps” into the container’s vertical center needs to behave like a typical form control selection. Yes, we’ll need JavaScript for that. 
let observer = new IntersectionObserver(entries => entries.forEach(entry => with(entry) if(isIntersecting) target.children[1].checked = true; ); , root: document.querySelector(`.scroll-container`), rootMargin: `-51% 0px -49% 0px` ); document.querySelectorAll(`.scroll-item`).forEach(item => observer.observe(item));
The IntersectionObserver object is used to monitor (or “observe”) if and when an element (called a target) crosses through (or “intersects”) another element. That other element could be the viewport itself, but in this case, we’re observing the .scroll-container for when a .scroll-item intersects it. We’ve established the observed boundary with rootMargin:"-51% 0px -49% 0px".  
A callback function is executed when that happens, and we can use that to apply changes to the target element, which is the currently selected .scroll-item. In our case, we want to select a .scroll-item that is at the halfway mark in the .scroll-container: target.children[1].checked = true.
That completes the code. Now, as we scroll through the items, whichever one snaps into the center position is the selected item. Here’s a look at the final demo again:
Let’s say that, instead of selecting an item that snaps into the .scroll-container‘s vertical center, the selection point we need to watch is the top of the container. No worries! All we do is update the scroll-snap-align property value from center to start in the CSS and remove the :first-of-type‘s top margin. From there, it’s only a matter of updating the scroll container’s background gradient so that the color stops highlight the top instead of the center. Like this:
And if one of the items has to be pre-selected when the page loads, we can get its position in JavaScript (getBoundingClientRect()) and use the scrollTo() method to scroll the container to where that specific item’s position is at the point of selection (which we’ll say is the center in keeping with our original demo). We’ll append a .selected class on that .scroll-item. 
<section class="scroll-container"> <!-- more items --> <label class="scroll-items selected"> 2024 <input type=radio name=items /> </label> <!-- more items --> </section>
Let’s select the .selected class, get its dimensions, and automatically scroll to it on page load:
let selected_item = (document.querySelector(".selected")).getBoundingClientRect(); let scroll_container = document.querySelector(".scroll-container"); scroll_container.scrollTo(0, selected_item.top - scroll_container.offsetHeight - selected_item.height);
It’s a little tough to demo this in a typical CodePen embed, so here’s a live demo in a GitHub Page (source code). I’ll drop a video in as well:
That’s it! You can build up this control or use it as a starting point to experiment with different layouts, styles, animations, and such. It’s important the UX clearly conveys to the users how the selection is done and which item is currently selected. And if I was doing this in a production environment, I’d want to make sure there’s a good fallback experience for when JavaScript might be unavailable and that my markup performs well on a screen reader.
References and further reading
0 notes
html-tute · 4 months ago
Text
HTML Graphics
Tumblr media
HTML provides various ways to include and work with graphics directly on web pages. The most common methods include using Canvas, SVG, and other techniques like CSS and WebGL for advanced graphics.
1. Canvas (<canvas>)
Purpose: The <canvas> element is a container for graphics that can be drawn using JavaScript. It's ideal for drawing shapes, making animations, creating charts, and developing games.
How It Works: The <canvas> element itself is just a container; the drawing is done with JavaScript, using a 2D or 3D context.
Attributes: width, height
Example: Drawing a rectangle on the canvas.<canvas id="myCanvas" width="200" height="100"></canvas><script> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "blue"; ctx.fillRect(10, 10, 150, 80); </script>
Use Cases:
Creating dynamic graphics and animations
Developing browser-based games
Rendering charts and graphs
2. SVG (Scalable Vector Graphics) (<svg>)
Purpose: The <svg> element is used to define vector-based graphics that can be scaled without losing quality. SVG is XML-based, which means each element is accessible and can be manipulated via CSS and JavaScript.
How It Works: SVG graphics are defined in XML format, which makes them easy to edit and manipulate.
Example: Creating a simple circle with SVG.<svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /> </svg>
Use Cases:
Icons and logos that need to be scalable
Creating complex vector illustrations
Responsive designs where graphics need to scale
3. CSS for Graphics
Purpose: CSS can be used to create and manipulate graphics through styles like gradients, shadows, and transformations.
How It Works: By using properties like background-image, border-radius, box-shadow, and transform, you can create graphic effects directly in CSS without using images.
Example: Creating a gradient background with CSS.<div style="width: 200px; height: 100px; background: linear-gradient(to right, red, yellow);"> </div>
Use Cases:
Adding simple graphical effects like gradients or shadows
Creating animations using keyframes
Designing layouts with complex shapes
4. WebGL
Purpose: WebGL (Web Graphics Library) is a JavaScript API for rendering 3D graphics within a web browser without the use of plugins.
How It Works: WebGL is based on OpenGL ES and provides a way to create complex 3D graphics and animations directly in the browser.
Example: WebGL is more complex and typically requires a JavaScript library like Three.js to simplify development.<!-- This is a simplified example, WebGL requires more setup --> <canvas id="glCanvas" width="640" height="480"></canvas> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> <script> var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000); var renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('glCanvas') }); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); var geometry = new THREE.BoxGeometry(); var material = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); var cube = new THREE.Mesh(geometry, material); scene.add(cube); camera.position.z = 5; var animate = function () { requestAnimationFrame(animate); cube.rotation.x += 0.01; cube.rotation.y += 0.01; renderer.render(scene, camera); }; animate(); </script>
Use Cases:
Creating complex 3D visualizations
Developing 3D games and simulations
Creating immersive virtual reality experiences
5. Inline SVG vs. <img> with SVG
Inline SVG: Directly embeds SVG code into the HTML, allowing for CSS and JavaScript manipulation.
<svg width="100" height="100"> <rect width="100" height="100" style="fill:blue" /> </svg>
<img> with SVG: Embeds an SVG file as an image, which is more static and less interactive.
<img src="image.svg" alt="Description">
Choosing the Right Method
Use <canvas> for dynamic, scriptable graphics.
Use <svg> for scalable, static graphics or when you need fine control over vector elements.
Use WebGL for 3D graphics and complex rendering tasks.
Use CSS for simple shapes, gradients, and animations.
These HTML5 graphics tools enable a wide range of visual possibilities, from simple shapes and icons to complex animations and 3D environments.
Read Me…
0 notes
digitalwithme · 7 months ago
Text
CSS
Cascading Style Sheets, or CSS, is a cornerstone technology in web development, wielding immense power and versatility in shaping the visual presentation of web pages. From defining layout structures to fine-tuning the minutest details of typography and color schemes, CSS empowers developers to create stunning and immersive digital experiences. Let's delve into the depths of CSS and explore its key features, functionalities, and the role it plays in modern web design.
Understanding CSS:
At its core, CSS is a style sheet language used to describe the presentation of a document written in a markup language like HTML. It works by selecting HTML elements and applying styles to them, defining how they should appear on the screen or other media. CSS allows developers to separate content from presentation, enabling greater flexibility and maintainability in web development projects.
Key Features and Functionality:
Selectors and Declarations: CSS employs selectors to target specific HTML elements and declarations to define the styles applied to those elements. Selectors can be based on element types, classes, IDs, attributes, or even hierarchical relationships within the HTML document.
Box Model: The CSS box model conceptualizes every HTML element as a rectangular box with content, padding, border, and margin areas. Developers can manipulate these properties to control the size, spacing, and positioning of elements on the page.
Layout and Flexibility: CSS offers various layout techniques, including floats, positioning, and the more modern Flexbox and Grid layouts. These tools empower developers to create responsive and adaptive designs that adapt to different screen sizes and devices seamlessly.
Typography and Fonts: With CSS, developers can customize typography by specifying font families, sizes, weights, styles, and spacing. CSS3 introduces advanced features like web fonts, text shadows, and text effects, further enhancing typographic creativity.
Colors and Gradients: CSS provides extensive capabilities for color manipulation, including specifying colors using hexadecimal, RGB, HSL, or named values. Additionally, CSS3 introduces gradient properties, allowing for the creation of smooth color transitions and dynamic backgrounds.
Transitions and Animations: CSS transitions and animations enable the creation of fluid and interactive user experiences. Developers can define animations for properties like opacity, position, and size, adding visual interest and engagement to web interfaces.
Media Queries: Media queries enable developers to apply different styles based on the characteristics of the device or viewport, such as screen size, resolution, or orientation. This facilitates the creation of responsive designs that adapt to various browsing contexts.
The Role of CSS in Modern Web Design:
In the ever-evolving landscape of web design, CSS plays a pivotal role in shaping the visual identity and user experience of websites and applications. Its versatility and expressive power empower designers and developers to bring their creative visions to life, while its modular and scalable nature promotes code maintainability and efficiency.
From simple layouts to complex animations, CSS offers a rich toolkit for crafting immersive digital experiences that captivate and engage audiences. By mastering the intricacies of CSS and staying abreast of emerging trends and best practices, web professionals can unlock the full potential of this indispensable technology and push the boundaries of what's possible in web design.
In conclusion, CSS stands as a cornerstone of modern web development, offering unparalleled control and flexibility in styling web content. Its robust features, combined with its ability to adapt to diverse design requirements, make it an indispensable tool for creating visually stunning and user-friendly websites and applications. As the web continues to evolve, CSS will undoubtedly remain at the forefront of innovation, driving the next generation of digital experiences forward.
Web Development Company in Dehradun
0 notes