Figma To Real Website | Responsive Homepage | HTML, CSS & JavaScript | Part 5

GTCoding
18 Dec 202119:23

Summary

TLDRThis tutorial series guides viewers through transforming a sigma design into a functional website using HTML, CSS, and JavaScript. The focus of this video is on designing the testimonial section, starting with setting margins and styling headings and paragraphs to match the design in Figma. The instructor demonstrates how to position elements side by side, hide mobile-specific buttons, and add stylistic touches like shadows and border radii. The video concludes with the addition of background rectangles and final adjustments to achieve a polished look for the testimonial section.

Takeaways

  • 🌐 The tutorial series focuses on converting a sigma design into a functional website using HTML, CSS, and JavaScript.
  • 🎨 The previous video covered the design of the hero section, which is visually demonstrated in a browser.
  • πŸ“ The current video's objective is to design the testimonial section as per the Figma file layout.
  • πŸ” The designer measures and replicates the gap between sections, which is consistently 100 pixels, using CSS margin properties.
  • πŸ–ŒοΈ Headings across different sections are styled uniformly with CSS, including custom properties for color and font-family.
  • πŸ“‘ The testimonial section consists of two parts side by side, styled with Flexbox to ensure proper alignment.
  • πŸ–ΌοΈ The testimonial cards are styled with properties like border-radius, box-shadow, and background color, taken from the Figma design.
  • πŸ“ Paragraphs within the testimonial section are given specific styles, including custom color variables and text alignment.
  • πŸ”„ The video demonstrates responsive design by adjusting the button's position for desktop and mobile views using CSS classes and display properties.
  • πŸ“ The position of images and buttons within the testimonial cards is fine-tuned using absolute positioning relative to the card.
  • 🎨 Background rectangles are added behind the testimonial cards using the ::before pseudo-element with specific dimensions and border-radius to match the design.
  • πŸ”„ The second testimonial card is adjusted to align with the first by translating it to the right and adjusting the ::before pseudo-element's styles accordingly.

Q & A

  • What is the main topic of the tutorial series?

    -The main topic of the tutorial series is converting a sigma design into a real website using HTML, CSS, and JavaScript.

  • What section of the website is designed in the previous video?

    -In the previous video, the hero section of the website was designed.

  • What is the first step in designing the testimonial section in the video?

    -The first step is to create a comment in the code to denote the start of the testimonials section.

  • How much gap is there between the testimonial section and the hero section according to the Figma file?

    -There is a gap of 100 pixels between the testimonial section and the hero section.

  • What CSS property is used to add a margin top of 100 pixels to all sections?

    -The 'margin-top' CSS property is used to add a margin of 100 pixels to all sections.

  • How are the headings styled in the video?

    -The headings are styled by copying the CSS from the Figma file, pasting it into the style.css file, and applying the same styling to all h2 elements.

  • What class is added to the h2 elements to style them as 'light'?

    -A class called 'light' is added to the h2 elements to style them with a white color.

  • How are the paragraphs inside the sections styled in the video?

    -The paragraphs are styled by copying the CSS from the Figma file and applying it to all p elements inside the sections using the 'section p' selector.

  • What CSS property is used to position the divisions side by side in the testimonial section?

    -The 'display: flex' property is used to position the divisions side by side in the testimonial section.

  • How are the testimonial cards styled in the video?

    -The testimonial cards are styled by copying the CSS properties such as border-radius, box-shadow, background-color, and width from the Figma file and applying them to the appropriate CSS selector.

  • What is the purpose of the 'before' selector used in the testimonial section?

    -The 'before' selector is used to add a background rectangle behind the testimonial cards, which is not part of the original HTML content.

  • How is the second testimonial card moved to the right in the video?

    -The second testimonial card is moved to the right by using the 'transform: translateX(20px)' CSS property on the ':last-child' pseudo-class.

  • What is the final step in styling the testimonial section in the video?

    -The final step is to add a border-radius to the 'info' division and set its background color to white for better visual appearance.

Outlines

00:00

πŸ“ Designing the Testimonial Section

This paragraph outlines the process of converting a design from a Figma file into a functional website using HTML, CSS, and JavaScript. The focus is on the testimonial section, following the completion of the hero section in a previous tutorial. The speaker discusses the importance of maintaining consistent spacing between sections and demonstrates how to apply a 100-pixel margin to achieve this. They also show how to style the testimonial section's heading using CSS, including copying styles from Figma and applying them to the HTML document.

05:00

πŸ–ŒοΈ Styling Elements and Positioning

The speaker continues with the design process, detailing the steps to style the testimonial section's paragraphs and positioning elements side by side using Flexbox in CSS. They address the need for a mobile button and a desktop button, explaining how to adjust the HTML structure to accommodate both. The paragraph also covers adding gaps between sections and aligning content vertically, as well as styling individual testimonial cards with specific CSS properties like border-radius, box-shadow, and background color.

10:01

πŸ”„ Adjusting Testimonial Card Styles

This section delves into the finer details of styling the testimonial cards, including setting margins, copying CSS properties from the design tool, and applying them to the HTML elements. The speaker discusses how to create a gap between testimonial cards and style the content within them, such as text and images. They also explain how to position an image within a testimonial card using absolute positioning and how to adjust the position of the second testimonial card to align with the design mockup.

15:04

πŸ–ΌοΈ Final Touches with Background and Z-Index

The final paragraph covers the addition of a background rectangle behind the testimonial cards using the ::before CSS pseudo-element. The speaker describes how to set the dimensions, position, and background color for this element, as well as how to apply border-radius to create a curved effect. They also address the need to adjust the z-index to ensure the background does not overlay other elements. The paragraph concludes with a review of the completed testimonial section and a call to action for viewers to like, subscribe, and comment for further questions.

Mindmap

Keywords

πŸ’‘HTML

HTML, or HyperText Markup Language, is the standard language used for creating and designing web pages. In the video, HTML is used to structure the website, with elements like 'section' and 'h2' tags defining different parts of the webpage such as the hero section and headings, respectively.

πŸ’‘CSS

CSS, or Cascading Style Sheets, is a stylesheet language used to describe the presentation of a document written in HTML. The video script discusses adding CSS properties like 'margin-top', 'color', and 'font-style' to style various sections of the website, such as the hero section and testimonial section.

πŸ’‘JavaScript

JavaScript is a programming language that allows interactive web pages and is often used in conjunction with HTML and CSS. Although not explicitly mentioned in the script, JavaScript would typically be used alongside HTML and CSS to create dynamic and interactive elements on a website.

πŸ’‘Figma

Figma is a design tool used for creating user interfaces in a collaborative environment. In the script, the Figma file is referred to as the source of design for the website's sections, with measurements and styles being taken from it to implement in the HTML and CSS code.

πŸ’‘Hero Section

The hero section is a term used in web design to describe the introductory section of a website, typically the first thing a visitor sees. In the video, the hero section is mentioned as having been previously designed, and the focus shifts to the testimonial section.

πŸ’‘Testimonial Section

A testimonial section on a website features positive reviews or endorsements from customers or clients. The script details the process of designing this section, including adding gaps, headings, paragraphs, and styling elements to present the testimonials attractively.

πŸ’‘Margin

In CSS, 'margin' is a property that sets the space around an element, outside of any defined borders. The script mentions setting 'margin-top' to 100 pixels for all sections to create consistent spacing between different parts of the webpage.

πŸ’‘Display Property

The 'display' property in CSS defines how an element should be displayed on a page. The script refers to setting the display property to 'flex' for the testimonial section to arrange the left and right divisions side by side.

πŸ’‘Media Queries

Media queries are CSS techniques used for applying different styles for different devices based on characteristics such as screen size. Although not explicitly mentioned, the concept is implied when discussing the mobile and desktop versions of the button placement.

πŸ’‘Responsive Design

Responsive design is an approach to web design that makes web pages render well on different devices and screen sizes. The script touches on this concept when adjusting the button's position for mobile and desktop views to ensure the website looks good on all devices.

πŸ’‘Comment

In programming, a 'comment' is a piece of code that is not executed but is used to explain the purpose or functionality of the code. The script describes adding comments in the code, such as 'testimonials section', to make the code more readable and maintainable.

πŸ’‘Variable

In CSS, a variable is a way to store a value that can be reused throughout the stylesheet. The script mentions using color variables like 'var dark blue color' for consistency in applying colors across different elements of the website.

πŸ’‘Pseudo-element

A pseudo-element in CSS is used to style specified parts of an element. The script refers to using the ':before' pseudo-element to add a background rectangle to the testimonial cards, demonstrating how pseudo-elements can be used for creative design effects.

Highlights

Introduction to the tutorial series on converting a sigma design into a real website using HTML, CSS, and JavaScript.

Explanation of how to design the hero section of the website as shown in the browser.

Demonstration of the gap measurement between sections in the Figma file and its replication in CSS with a margin-top of 100 pixels.

Styling the testimonial section heading by copying CSS from the Figma file and applying it to all h2 elements.

Adjusting the heading color to white for the testimonial section using a class called 'light'.

Styling the paragraph text with CSS, including color, font style, and margin adjustments.

Positioning the left and right divisions side by side within the testimonial section using flex display.

Adding a class for the mobile button and positioning the desktop button within the right division.

Hiding the mobile button on desktop views with CSS display property set to none.

Adding a gap between the left and right divisions and aligning content vertically with CSS properties.

Styling the testimonial card with properties such as border-radius, box-shadow, background-color, and width.

Creating a margin-bottom for testimonial cards to add spacing between them.

Styling the content inside the testimonial with padding, background color, and text properties.

Applying different background colors to alternate testimonial contents for visual distinction.

Styling the testimonial heading with specific CSS properties copied from the Figma design.

Adding padding to the 'info' division and setting the border-radius for a rounded look.

Styling the company paragraph with specific text properties to match the design.

Positioning the testimonial image with absolute positioning relative to the testimonial card.

Adjusting the position of the second testimonial card to the right to match the Figma design.

Adding a gap between the button and paragraph by creating a 'features' division and applying margin.

Using the 'before' selector to add a background rectangle behind the testimonial cards with specific dimensions and styling.

Adjusting the height and z-index of the 'before' selector to ensure it is positioned correctly behind the content.

Final adjustments to the border-radius and background color of the 'info' section for a polished look.

Conclusion of the tutorial with an invitation for questions, likes, and subscriptions for more video updates.

Transcripts

play00:00

hi everybody welcome to gt coding in

play00:02

this tutorial series we are converting

play00:03

this sigma design into a real website

play00:05

using html css and javascript now in my

play00:08

previous video i showed you how to

play00:09

design this hero section so if you go to

play00:11

our browser this is how it looks right

play00:13

now we can see that we have designed the

play00:14

hero section now in this video we will

play00:16

see how to design this testimonial

play00:18

section

play00:19

so if you go back to our figma file this

play00:21

is how we want our testimonials section

play00:23

to look

play00:24

so let's get started

play00:25

[Music]

play00:31

all right here's our code so first of

play00:32

all let's go ahead and create a comment

play00:35

so i'll just type testimonials section

play00:38

and let's go back to our figma file and

play00:41

the first thing we will do is we will

play00:42

see what is the gap between the

play00:44

testimonials section and this hero

play00:46

section

play00:47

so if i click over here and if i press

play00:49

alt or option you can see that we have

play00:53

a gap of 100 pixels and if we scroll

play00:55

down and take a look at this gap over

play00:57

here we can see that even for this we

play00:59

have a gap of 100 pixels let's scroll

play01:02

down and take a look at the gap of this

play01:04

and we can see that we have a gap of 100

play01:06

pixels for every section over here so

play01:09

let's go back to our css and we will add

play01:11

a margin top of 100 pixels for all the

play01:14

sections

play01:15

so if you go back to our html file we

play01:17

can see that for each of the sections we

play01:19

have this

play01:20

section over here so here we can see we

play01:22

have this section

play01:23

and even for the courses we have this

play01:25

section

play01:27

so let's go ahead and

play01:29

let's type section

play01:31

and here i'll just type margin top and

play01:33

i'll just set it to 100 pixels

play01:35

right now let's go back to our figma

play01:37

file

play01:38

and the next thing we will style is this

play01:40

heading so if i double click over here

play01:43

and let's go over here to inspect and if

play01:45

you scroll down we can see that the css

play01:47

of the heading is displayed over here so

play01:49

let's go ahead and copy all of this

play01:51

and let's go back to our code and if you

play01:54

go back to the index.html file here we

play01:57

can see for all the headings we have an

play01:59

h2

play02:00

so here we can see for the testimonial

play02:02

section we have this h2 over here for

play02:04

the heading and if you scroll down we

play02:06

can see that we have the h2 for the

play02:08

courses section as well

play02:09

and if we scroll down we also have the

play02:11

h2 for the get our app section so we can

play02:14

go ahead and add the same styling to all

play02:16

the headings so let's select all the h2

play02:18

in general so let's go back to style.css

play02:21

file and here i'll just type h2

play02:23

and i just pasted all the css over here

play02:26

and let's delete this comment and also

play02:29

font style and i'll just add sans serif

play02:31

over here

play02:34

and i'll also change the color to the

play02:36

variable so i'll just type var

play02:39

dark blue color

play02:41

and we'll also remove all the default

play02:42

margins so i'll just type margin zero

play02:45

right now let's go to our browser and

play02:46

let's scroll down and

play02:48

here we can see we have the heading and

play02:50

the styles are applied over here now for

play02:52

this heading we have a color of white so

play02:55

if we go back to our figma file here we

play02:58

can see for this heading we have a white

play03:00

color

play03:01

and for that if you go back to our html

play03:03

file

play03:04

we have added a class called light so

play03:08

if i just scroll down over here

play03:11

here we can see we also have a class

play03:12

called light for the h2

play03:15

so let's go back to our style.css file

play03:17

and here we will type h2 dot light

play03:20

and we'll set the color to white

play03:23

now if we go back to our browser we can

play03:25

see that for this heading we have a

play03:27

white color

play03:29

right now let's style this paragraph so

play03:32

let's go back to our figma file and

play03:34

let's double click over here

play03:36

and here if you go to the inspect tab we

play03:37

can see the css over here so i just copy

play03:39

all of the css

play03:41

and let's go back and here i'll just

play03:43

type section

play03:45

p

play03:46

so this will select all the paragraphs

play03:48

inside all the sections so i'll just

play03:50

paste the css over here

play03:52

and let's change the color to our

play03:54

variable so i'll just type var

play03:57

dark blue color

play03:58

and i'll just remove this comment and

play04:00

this font style

play04:03

and we'll also add sans serif over here

play04:07

and let's go back to our browser and

play04:09

we'll also add some margin so let's go

play04:12

ahead and type margin

play04:14

of let's add a margin of 12 pixels top

play04:17

and bottom and zero for left and right

play04:19

right now let's add some specific styles

play04:21

for this testimonial section so let's go

play04:23

back and if you go to the figma file

play04:26

we can see that we have these sections

play04:28

one next to the other so this is the

play04:30

left part

play04:31

and this is the right part so if you go

play04:32

back to our html

play04:35

here we can see we have two divisions

play04:37

over here

play04:38

we have a division with the class of

play04:39

left

play04:40

and here we have a division with the

play04:42

class of right now we have to position

play04:44

these divisions one next to the other so

play04:46

for that you have to select the parent

play04:47

division so if you scroll up

play04:49

here we can see we have a section with

play04:51

the class of testimonials section so

play04:52

let's select this let's go back to our

play04:54

css and here i'll just type testimonials

play04:57

section

play05:00

and we'll set the display to flex so

play05:01

that both the divisions will be one next

play05:03

to the other so if we go back to our

play05:05

browser here we can see we have this

play05:08

left section over here on the left and

play05:09

then we have this right section

play05:11

but here we can see we have this button

play05:13

over here on the right

play05:14

so let's go back to our html and

play05:17

here we can see we have this left

play05:19

section

play05:20

and then we have this right section and

play05:21

then we have this button over here so

play05:23

what we will do is we'll copy this

play05:25

button inside the right section now we

play05:27

need to have a button over here for the

play05:29

mobile version but for the desktop

play05:30

version we need to have a button inside

play05:32

the right division

play05:34

so here i will just add a class of

play05:36

mobile button

play05:39

and let's copy this line of code and

play05:40

let's go inside the right division and

play05:43

here after the paragraphs i just add the

play05:45

button

play05:46

and for this button we will have a class

play05:48

of desktop button

play05:49

right now let's go to our style.css file

play05:51

and we need to hide this mobile button

play05:54

so here i'll just type testimonials

play05:57

section

play05:58

mobile button

play06:00

and i'll just set the display to none

play06:05

and now if you go back to our browser we

play06:06

can see that everything looks all right

play06:08

we have the button in the correct

play06:09

position now the next thing we will do

play06:11

is we will add a gap between the left

play06:13

and the right divisions so let's go back

play06:14

to our css

play06:16

and here i just type gap and we'll add a

play06:18

gap of 100 pixels

play06:21

and we also want all the elements to be

play06:22

aligned to the center vertically so if

play06:24

you go back to our figma file here we

play06:26

can see both the content are aligned to

play06:28

the center vertically so let's go back

play06:30

to our css and here let's type align

play06:33

items center

play06:35

and now we can see everything is

play06:37

centered correctly

play06:38

right now let's style this testimonial

play06:41

card

play06:42

so let's go back to our figma file and

play06:44

let's double click over here

play06:47

and let's go to inspect and let's scroll

play06:49

down

play06:50

and here we can see the styles for the

play06:51

testimonial card so we need to have a

play06:53

border radius of 24 pixels and we need

play06:56

to have this box shadow and background

play06:58

color and we also need to have this

play07:00

width so let's copy all of this and

play07:02

let's go back to our css and let's see

play07:05

what is the class for the testimonial

play07:06

card

play07:07

so here we can see we have a division

play07:09

with the class of testimonial card

play07:12

so let's target that here let's type

play07:14

testimonials section testimonial card

play07:17

and i just pasted all the css over here

play07:20

and we need to remove this height left

play07:23

and top

play07:24

from here

play07:25

right now let's go back to our browser

play07:27

and here we can see all the styles are

play07:28

added we'll also add some gap between

play07:31

these two testimonial cards

play07:33

so let's go back to our figma file and

play07:36

if we hover over this we can see we have

play07:38

a gap of 50 pixels

play07:41

so here i'll just type margin bottom

play07:45

and i'll just set it to 50 pixels

play07:49

right now the next thing we will do is

play07:51

we will style this content inside the

play07:53

testimonial so let's go back to our

play07:55

figma file and i'll just double click

play07:56

over here and here we can see the styles

play07:58

for this text so i'll just copy all of

play08:00

this

play08:01

and let's go back to our

play08:04

code and if you go to our index.html

play08:06

file

play08:07

here we can see we have a division with

play08:09

a class of content so let's target this

play08:12

division so i'll just go back to css and

play08:14

here i'll just type

play08:15

testimonials section and in that we have

play08:18

the testimonial card

play08:20

and in that we have the content

play08:23

so here i'll just paste the css

play08:25

and let's remove this comment and also

play08:27

this font style and we'll also add sans

play08:30

serif over here

play08:33

right now let's go back to our figma

play08:35

file and here we can see we have a

play08:36

padding of 24 pixels for top and bottom

play08:40

and 32 pixels for left and right and if

play08:42

i click on this rectangle and here we

play08:44

can see

play08:46

we have a border radius of 24 pixels and

play08:48

we have a light blue color so let's go

play08:51

back and let's add those styles so let's

play08:53

type border radius

play08:55

24 pixels and we also had a padding of

play08:58

24 pixels top and bottom and 32 pixels

play09:01

left and right

play09:02

and we'll also set the background color

play09:04

to

play09:06

the light blue color variable that we

play09:07

have so if you scroll up

play09:09

we can see that we have created this

play09:11

variable called light blue color so

play09:13

let's add this

play09:15

so here let's type var light blue color

play09:18

all right let's go back to our browser

play09:20

and we can see that the content is being

play09:22

styled correctly now for the second

play09:24

content we need to have an orange color

play09:27

so if we go back to our figma file here

play09:28

we can see for the second content

play09:30

we have the orange background color so

play09:33

let's go back to our css and here i'll

play09:35

just type testimonials section

play09:38

and testimonial card

play09:40

and we need to select the last instance

play09:42

of the testimonial card so here i'll

play09:43

just type colon last child

play09:46

and then here let's type content so what

play09:48

we are doing over here is that we are

play09:50

selecting the last testimonial card and

play09:52

we are adding the styles to the content

play09:54

inside that

play09:55

so here let's type background

play09:58

and i'll just set the color to var and

play10:00

orange color

play10:01

and let's go back to our browser and now

play10:03

we can see we have this orange

play10:05

background color for the second

play10:06

testimonial content

play10:09

right now let's style this heading so

play10:11

let's go back and

play10:13

let's go to our html and here we can see

play10:15

for the heading we have this h4 and it

play10:18

is inside this info division so let's

play10:20

target that so here let's type

play10:23

testimonials section

play10:25

testimonial card

play10:26

info

play10:28

h4 and let's go back to our figma file

play10:30

and let's copy the styles so let's

play10:32

double click over here

play10:34

and here we have the css of the h4 so

play10:36

let's copy all of this

play10:38

and let's go back to our code and i'll

play10:40

just paste it over here

play10:42

and i'll just change this color to our

play10:43

variable so i'll just type var dark blue

play10:46

color and we'll just remove this comment

play10:49

and also the font style and we'll also

play10:51

add sans serif over here

play10:54

let's go back to our browser and we'll

play10:56

also remove the margin so i'll just type

play10:58

margin 0

play11:01

and we also need to have a padding for

play11:03

this info division so let's go back

play11:05

and let's target the info division so

play11:07

i'll just type testimonials card or

play11:09

testimonials section testimonials card

play11:13

and

play11:14

dot info

play11:16

and we will add a padding of

play11:19

24 pixels top and bottom and 32 pixels

play11:21

left and right

play11:23

right now if we go back to our browser

play11:24

we can see that we have the padding

play11:25

applied we'll also add the styles to

play11:28

this paragraph so if we go back to our

play11:30

html we can see inside the info division

play11:32

we have a paragraph with the class of

play11:34

company

play11:36

so let's target that over here so i'll

play11:37

just type testimonials section

play11:40

testimonial card info

play11:43

and i'll just type

play11:45

p dot company

play11:47

and let's go back to our figma file and

play11:49

let's copy the styling so i'll just

play11:50

double click over here

play11:53

and let's copy the styles so let's copy

play11:56

all of this from here

play11:58

and let's go back to our css and paste

play12:00

it over here

play12:02

and we'll just remove all the

play12:03

unnecessary code and i just add the

play12:06

variable over here dark blue color

play12:09

and also delete this line of code and

play12:12

also add sensative over here

play12:15

all right now let's go back to our

play12:16

browser and we can see that the styling

play12:18

is applied

play12:20

now the next thing we will do is style

play12:21

this image so let's go back to our

play12:24

html file and here we can see we have

play12:26

this image inside the testimonial card

play12:28

division

play12:29

so let's target that

play12:31

here the stop testimonials section

play12:33

testimonial card

play12:35

and here let's type img and let's go

play12:38

back to our figma file

play12:40

and let's double click over here

play12:43

and here we can see the css of the image

play12:45

so i'll just copy this height and width

play12:47

and let's go back and paste it over here

play12:50

i will position this image relative to

play12:52

this testimonial card division so let's

play12:54

go over here to the top and for the

play12:56

testimonial card i will just type

play12:58

position

play12:59

relative

play13:01

now let's go over here to the image and

play13:03

let's type position absolute now this

play13:05

image will be positioned relative to

play13:07

this testimonial card so let's add some

play13:09

position values over here so i'll just

play13:11

type right and i'll just set the right

play13:13

position to 32 pixels and we'll set the

play13:15

bottom position to

play13:17

20 pixels let's see how it looks let's

play13:19

go back to our browser and we can see

play13:22

that the image looks alright we don't

play13:24

have any problems

play13:25

now the next thing we have to do is we

play13:26

have to move the second testimonial card

play13:29

to the right a little bit so if we go

play13:31

back to our figma file here we can see

play13:32

the second testimonial card is moved to

play13:35

the right so let's do that let's go back

play13:37

to our css

play13:39

and let's select the second testimonial

play13:41

card so i'll just have testimonials

play13:43

section

play13:44

testimonial card and here let's type

play13:46

colon last child so this will select the

play13:49

second testimonial card

play13:51

and here we'll just type transform

play13:53

translate x

play13:55

and i'll just set it to 20 pixels

play13:58

and now we can see the second

play13:59

testimonial card is moved to the right

play14:02

all right now the next thing we will do

play14:04

is we will add some gap between this

play14:06

button and this paragraph

play14:08

so

play14:09

let's go over here to the html

play14:12

and i'll just add a division for both

play14:14

these paragraphs so here i'll just

play14:16

create a division with the class of

play14:18

features

play14:20

and we'll add these paragraphs inside

play14:22

the features

play14:26

right now let's add some margin to these

play14:27

features so here i'll just type

play14:29

testimonials section features and here

play14:32

i'll just type margin bottom and i'll

play14:34

just set it to 30 pixels

play14:36

all right now the last thing we need to

play14:38

do is add this background rectangle over

play14:40

here

play14:41

so we have this rectangle behind both

play14:43

these testimonial cards now for that

play14:45

we're going to use a before selector so

play14:47

let's go back and

play14:49

let's select

play14:51

the testimonial card so here

play14:53

just before this css i'll just type

play14:56

testimonials section testimonial card

play15:00

colon column before

play15:03

and before selectors are basically used

play15:06

to add extra information to the elements

play15:08

of your website so if i just type

play15:10

content and here if i just type hello

play15:14

now you can see that hello is displayed

play15:15

over here before all these testimonial

play15:18

cards so let's remove hello from here

play15:20

and i'll just keep it blank

play15:23

and let's add the background rectangle

play15:25

over here so let's go back to our figma

play15:27

file and let's select this rectangle and

play15:30

let's see what is the width

play15:32

so here we can see we have a width of 28

play15:34

pixels

play15:36

so let's go back

play15:38

and here let's type width 28 pixels

play15:41

and we will set the position to absolute

play15:45

and we'll set a height of

play15:47

let's try 40 pixels

play15:49

and let's set the top position to

play15:50

negative

play15:51

40 pixels so that it is at the top and

play15:55

we'll set the left position to

play15:57

let's try 60 pixels and we also need to

play16:00

have the background color set to the

play16:02

dark color so i'll just type var dark

play16:04

blue color

play16:05

and we'll also need to add a border

play16:07

radius so just a border radius and we

play16:09

need to add border readers for top right

play16:12

and top left so i just tap 24 pixels 24

play16:15

pixels for top left and top right so

play16:18

here we can see we have this border

play16:19

radius of 24 pixels and for bottom left

play16:22

and bottom right i'll just type 0 0

play16:24

right now let's go back to our browser

play16:26

and now we can see we have this

play16:28

background rectangle over here at the

play16:30

top

play16:31

and now for the second testimonial card

play16:32

we will add a different styling for the

play16:35

before selector so let's go back

play16:38

and uh here i'll just type testimonials

play16:40

section

play16:41

testimonial card

play16:44

colon last child for selecting the

play16:46

second testimonial card and here you

play16:48

stop column column before

play16:52

now since we have moved this second

play16:54

testimonial card 20 pixels to the right

play16:57

so if you go back over here

play16:59

here we can see we have moved it 20

play17:00

pixels to the right

play17:02

so we have to set the left position of

play17:04

this before selector to 20 pixels to the

play17:07

left so here i'll just tap left and here

play17:09

we have set a value of 60 pixels so here

play17:11

we have to type 40 pixels

play17:15

and we'll set the top position to

play17:17

negative 50 pixels and now we can see

play17:19

both these rectangles are in the same

play17:21

line now we don't want to have this

play17:23

border radius at the top so here i'll

play17:26

just type border radius and i'll just

play17:28

type 0 0 for top left and top right and

play17:30

we want the border radius at the bottom

play17:32

so here we can see

play17:34

at the bottom we have this border radius

play17:36

so let's add 24 pixels of border edges

play17:39

to the bottom left and bottom right

play17:42

right now let's go back to our browser

play17:45

and here we can see we have this

play17:46

rectangle now we need to set the height

play17:48

of this before selector so let's go back

play17:52

and let's set a height of

play17:55

calc we will use a calc function and i

play17:57

will set the height to hundred percent

play17:58

of the element

play18:00

plus

play18:01

90 pixels

play18:03

and let's see how it looks

play18:05

and now we can see we have the correct

play18:06

height for this element but it is above

play18:09

all the other elements so we have to set

play18:11

a z index of negative one for this so

play18:13

i'll just type z index

play18:15

and i'll just type negative one

play18:17

and now we can see it looks like it is

play18:19

above the info section so let's go back

play18:21

to the

play18:22

info section over here

play18:25

let's scroll down

play18:26

and here we will add a background color

play18:29

so just type background and i'll just

play18:31

set it to white now the last issue we

play18:33

need to fix is the border radius over

play18:35

here so

play18:36

we need to set the border radius of the

play18:38

info to 24

play18:40

pixels so let's go back and here in the

play18:43

info i'll just type border radius

play18:46

and i'll just set it to 24 pixels

play18:49

and now we can see everything looks

play18:50

alright so that's basically it with the

play18:53

testimonial section of our website

play18:55

alright so that's it for this video if

play18:56

you have any doubts you can ask in the

play18:57

comments below and if you like this

play18:59

video please click on the like button

play19:00

and subscribe to this channel to get the

play19:02

latest video updates thanks a lot for

play19:04

watching have a nice day

play19:07

[Music]

play19:22

you

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Web DevelopmentHTML CodingCSS StylingJavaScriptTutorial SeriesDesign ConversionWebsite BuildingTestimonial SectionFigma IntegrationResponsive DesignCoding Tips