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

GTCoding
20 Dec 202112:30

Summary

TLDRThis tutorial video guides viewers through the process of transforming a design into a functional website, focusing on the 'courses section'. The instructor demonstrates how to use HTML, CSS, and JavaScript to style the section, including adding a background color, padding, and centering the heading. Viewers learn to align course cards side by side with a specified gap, apply flexbox for layout, and style individual elements like images, course cards, headings, and duration with appropriate margins, padding, and colors. The tutorial concludes with positioning a button and adjusting the overall padding for a polished look.

Takeaways

  • 🎨 The tutorial series focuses on converting a design into a functional website using HTML, CSS, and JavaScript.
  • 🔄 The previous video covered the design of the testimonial section, while the current video discusses the design of the courses section.
  • 📝 The courses section is styled with a specific class in the HTML file, and the styling is applied in the style.css file.
  • 🌈 A background color is applied to the courses section by copying the CSS from the Figma design file.
  • 📏 Padding is added to the top and bottom of the courses section to create space, with 70 pixels specified for both.
  • 🔄 The heading within the courses section is centered using CSS text alignment properties.
  • 🔗 Course cards are arranged side by side using flex display and a gap of 70 pixels between them.
  • 🖼️ Images within the course cards are set to 100% width of their container for proper scaling.
  • 📐 Rounded corners and a drop shadow are applied to the images by copying the border-radius and box-shadow CSS properties from Figma.
  • 🏷️ Each course card is styled with a white background, padding, and a margin to ensure visual separation and alignment.
  • 📝 The course card's heading and duration are styled and positioned using flex properties to align them appropriately within the card.
  • ⏰ A clock icon is added to the duration element using a CSS pseudo-element and positioned with absolute properties relative to the duration container.
  • 🔲 A rectangle is added at the bottom of the course card using an after pseudo-element with specific dimensions and color.
  • 📍 The button is positioned to the right of the wrapper within the courses section using absolute positioning.

Q & A

  • What is the main focus of this tutorial series?

    -The main focus of this tutorial series is to convert a sigma design into a real website using HTML, CSS, and JavaScript.

  • What sections of the website have been designed in the previous video?

    -In the previous video, the hero section and the testimonials section of the website were designed.

  • What section of the website is the focus of the current video?

    -The focus of the current video is the design of the courses section of the website.

  • How is the courses section styled in the video?

    -The courses section is styled with a background color, padding, and text alignment for the heading to the center.

  • What CSS property is used to align the course cards side by side?

    -The CSS property 'display: flex' is used to align the course cards side by side.

  • What is the purpose of setting the image width to 100% of the container?

    -Setting the image width to 100% of the container ensures that the image takes up the full width of its container, maintaining the design's aspect ratio.

  • How are the course cards styled to have rounded corners and a drop shadow?

    -The course cards are styled with a 'border-radius' of 24 pixels and a 'box-shadow' to achieve rounded corners and a drop shadow effect.

  • What is the significance of using the 'flex' display for the 'info' class in the course card?

    -Using 'display: flex' for the 'info' class allows the heading and duration to be positioned next to each other, with space between and centered vertically.

  • How is the clock symbol added to the duration in the course card?

    -The clock symbol is added using a ':before' pseudo-element with the 'content' property set to the URL of the clock image.

  • What CSS property is used to position the button to the right of the courses section?

    -The 'position: absolute' property is used, with the 'right' value set to 0, to position the button to the right of the courses section.

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

    -The final step is to add padding to the bottom of the courses section, with a padding of 120 pixels applied to ensure there is enough space at the bottom.

Outlines

00:00

📚 Designing the Courses Section

The speaker introduces the tutorial series focused on transforming a sigma design into a functional website using HTML, CSS, and JavaScript. They recap the progress made on the hero and testimonials sections and announce the focus of the current video: designing the courses section. The speaker navigates to the HTML file, identifies the relevant section, and begins styling it by adding a comment in the CSS file. They proceed to set the background color, padding, and text alignment for the heading. The speaker also discusses arranging course cards side by side with a specified gap, setting the image width to 100% of the container, and applying rounded corners and a drop shadow to the images. Styling for individual course cards includes setting border radius, background color, and padding, as well as adding margins. The video also covers styling the course card headings with specific CSS properties copied from the Figma design file.

05:01

🎨 Styling Course Card Headings and Durations

This paragraph delves into the detailed styling of the course card headings and durations. The speaker modifies the heading's color, font style, and adds 'sans-serif' to the CSS. They demonstrate how to align the heading and duration side by side using flex display and adjust the gap between them. The speaker then positions the heading on the left and the duration on the extreme right within the info division, using 'justify-content' and 'space-between' properties. The duration's styling is addressed next, with the speaker copying the necessary CSS from the Figma file and adjusting the color to a variable dark blue. To achieve a two-line duration display within a single line, the speaker adds 'white-space: nowrap;'. A clock symbol is added to the duration using a 'before' pseudo-element with the image URL. Positioning and padding adjustments are made to ensure the symbol is correctly placed. The speaker also discusses adding a rectangle at the bottom of the course card using an 'after' pseudo-element and describes the styling process for this element.

10:02

🔚 Final Touches to the Courses Section

The final paragraph covers the finishing touches for the courses section. The speaker discusses positioning a button to the right side of the wrapper within the courses section by setting the position to 'absolute' and adjusting the right property. Padding adjustments at the bottom of the courses section are made to ensure the layout looks balanced. The speaker concludes by stating the completion of the courses section design and encourages viewers to find the complete playlist in the video description, ask questions in the comments, and subscribe for updates. They end with a thank you and sign off.

Mindmap

Keywords

💡HTML

HTML, or HyperText Markup Language, is the standard markup language used to create web pages. It defines the structure and layout of a web document by using a variety of tags and attributes. In the video's context, HTML is essential for setting up the basic structure of the website, such as the 'courses section' with its specific class, which is then styled using CSS.

💡CSS

CSS, or Cascading Style Sheets, is a stylesheet language used for describing the presentation of a document written in HTML. It allows for the control of layout, colors, fonts, and other visual aspects of web pages. In the video, CSS is used extensively to style various elements of the 'courses section', including background color, padding, and text alignment.

💡JavaScript

JavaScript is a programming language that enables interactive web pages. It is used to create dynamic content that can update and manipulate HTML document objects. Although not explicitly mentioned in the script, JavaScript is commonly used alongside HTML and CSS to create fully functional websites, which could be part of the tutorial series' broader scope.

💡Figma

Figma is a cloud-based design tool primarily used for user interface and user experience design. It allows designers to create, collaborate, and share designs easily. In the script, Figma is used to design the layout and elements of the 'courses section', and the CSS properties are extracted from Figma to apply to the HTML elements.

💡Section

In web design, a 'section' refers to a distinct part of a web page that encloses a specific type of content. In the video, the 'courses section' is a designated area for displaying course information, and the script describes how to style this section with CSS properties such as background color and padding.

💡Padding

Padding in CSS is the space between the content of an element and its border. It is used to create visual separation and improve the layout's aesthetics. The script mentions adding padding to the 'courses section' to create spacing around the content, enhancing the design's appeal.

💡Flexbox

Flexbox is a CSS layout mode that provides an efficient way to distribute space among items in a container, even when their size is unknown or dynamic. The script describes using 'display: flex' on the 'course cards' to align them horizontally with a specified gap, showcasing Flexbox's utility in aligning elements.

💡Border-radius

The 'border-radius' property in CSS is used to create rounded corners on elements. In the video, this property is applied to images and course cards to give them a smooth, rounded appearance, which is a common design practice for modern web interfaces.

💡Drop Shadow

A 'drop shadow' is a visual effect that simulates the shadow of an element as if it were raised above the page, creating depth. In the script, a drop shadow is added to images to enhance their visual appeal and make them stand out against the background.

💡Media Query

Media queries are CSS techniques used for applying different styles for different devices based on characteristics such as screen size, resolution, or orientation. Although not explicitly mentioned in the script, media queries are a fundamental part of responsive web design, which is likely covered in the tutorial series.

💡Responsive Design

Responsive design is an approach to web design that makes web pages render well on different devices and screen sizes, from desktops to mobile phones. The use of padding, flexbox, and other CSS properties mentioned in the script contributes to creating a responsive design, ensuring the 'courses section' looks good on all devices.

Highlights

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

Progress update on the design of the hero and testimonial sections.

Starting the design of the courses section in the tutorial.

HTML file navigation and identification of the courses section.

CSS styling of the courses section background color.

Adding padding to the courses section for aesthetic spacing.

Centering the heading of the courses section for visual balance.

Arranging course cards side by side using flex display.

Setting image width to 100% of the container for consistency.

Applying rounded corners and drop shadow to images for a modern look.

Styling individual course cards with border radius and background color.

Adding margins to course cards for spacing.

Styling the course card headings with text alignment and color.

Using flex display to align the heading and duration side by side.

Styling the duration with specific font properties and color.

Adjusting the positioning of the duration text within the card.

Adding a clock symbol to the duration indicator for clarity.

Styling a rectangle at the bottom of the course card for emphasis.

Positioning a button to the right side of the courses section.

Adding padding at the bottom of the courses section for layout balance.

Completion of the courses section design with a review in the browser.

Invitation to follow the complete playlist and engage with the content.

Encouragement to like, subscribe, and comment for further interaction.

Transcripts

play00:00

hi everybody welcome to gt coding in

play00:01

this tutorial series we are converting

play00:03

this sigma design into a real website

play00:05

using html css and javascript now in the

play00:07

previous video i showed you how to

play00:09

design this testimonial section

play00:11

and if you go to the browser

play00:13

here you can see this is our progress as

play00:14

of now we have designed the hero section

play00:16

and also the testimonials section now in

play00:18

this video i'll show you how to design

play00:20

this

play00:21

courses section over here so let's get

play00:23

started

play00:24

[Music]

play00:30

right here i'm in the code so let's go

play00:31

to the html file

play00:33

and let's scroll down and here we can

play00:35

see for the courses section

play00:37

we have this section with the class of

play00:39

courses section and in that we have this

play00:40

rapid division to have a max width for

play00:43

all the content inside the courses

play00:45

section and in that we have all this

play00:46

content over here so first of all let's

play00:49

tile this courses section so let's go

play00:51

back to our style.css file

play00:54

and here we'll just create a comment

play00:55

i'll just type courses section

play01:00

and here let's type dot courses section

play01:03

and let's go back to our figma file and

play01:05

let's get the css

play01:06

so let's double click over here and

play01:09

here let's go to inspect and let's

play01:10

scroll down and here we can see we have

play01:12

this background color so let's copy this

play01:16

and let's paste it over here

play01:18

all right now the next thing we will do

play01:20

is we will add a padding so here we can

play01:22

see on top of this we have a padding of

play01:24

70 pixels so let's add a padding over

play01:27

here so i'll just start padding

play01:28

70 pixels for top and bottom and i'll

play01:31

just type 0 for left and right

play01:33

right now let's go back to our browser

play01:36

and here we can see we have this courses

play01:37

section now we have to text align this

play01:39

heading to the center so let's go back

play01:41

and if you go to the html here we can

play01:43

see we have this h2 inside this courses

play01:45

section

play01:46

so here i'll just type

play01:48

courses section

play01:51

h2 and here let's tap text align center

play01:55

and now we can see the heading is in the

play01:56

center all right now the next thing we

play01:58

need to do is we need to bring both

play01:59

these course cards one next to the other

play02:01

so if you go back to the figma file here

play02:03

we can see we have this course card over

play02:05

here on the left and then we have the

play02:07

next course card here on the right so

play02:09

let's go back and

play02:11

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

play02:13

we have a division with the class of

play02:14

course cards and that we have these two

play02:17

course cards over here

play02:19

so let's add a display of flex to this

play02:21

course cards

play02:22

so here let's type

play02:24

courses section course cards

play02:27

and i'll set the display to flex

play02:29

and we will have a gap of let's go back

play02:32

to our figma file and let's see what is

play02:33

the gap

play02:35

so if i click over here and if i press

play02:38

alt

play02:38

we can see we have a gap of 73 pixels

play02:42

i'll just round it to 70 pixels so let's

play02:44

go back

play02:45

and here you start 70 pixels

play02:48

right now let's go back to our browser

play02:49

and here we can see now we have these

play02:51

course cards one next to the other now

play02:53

let's set the width of the image to 100

play02:56

of the container so here i'll just type

play02:58

courses section

play02:59

course cards

play03:01

img and here i'll just set the width to

play03:03

100

play03:05

and now we can see we have the correct

play03:07

width for the image

play03:09

right now let's go back to our figma

play03:10

file and here we can see for the image

play03:12

we also have rounded corners so let's

play03:14

double click over here on this image

play03:16

and here we can see we have a border

play03:19

radius of 24 pixels and we also have

play03:22

this drop shadow so let's copy about

play03:24

these lines of code

play03:26

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

play03:28

paste

play03:29

it inside the image

play03:31

and let's go back to our chrome

play03:33

and now we can see we have the drop

play03:35

shadow and the rounded corners all right

play03:37

now the next thing we will do is we will

play03:39

style the course card so let's go back

play03:41

to our

play03:42

html

play03:43

and here we can see for each of the

play03:44

course cards we have this division of

play03:46

the class of course card so let's style

play03:49

this

play03:49

let's go back to our style.css file

play03:52

and here let's tap courses section

play03:54

and course card

play03:57

and let's go back to our figma file and

play03:59

here we can see we have this border

play04:00

radius of 24 pixels and a background

play04:03

color of white

play04:04

and we also have a padding of zero top

play04:07

and bottom and 32 pixels left and right

play04:10

so let's copy these two lines of code

play04:12

and let's go back

play04:14

and i'll just paste it over here

play04:16

and let's go back and i'll also copy

play04:18

this padding

play04:20

and paste it over here

play04:22

right now let's go back to our browser

play04:24

and here we can see we have this white

play04:25

background color

play04:27

and we'll also have some margin at the

play04:29

top so let's set a margin

play04:32

of 40 pixels for top and bottom and zero

play04:34

for left and right and now we can see we

play04:36

have this margin at the top

play04:38

all right now the next thing we will do

play04:39

is style this heading so let's go back

play04:41

to our figma file

play04:43

and let's double click over here

play04:46

and let's go to the inspect and let's

play04:48

scroll down and here we can see the css

play04:50

of this heading so let's copy all of

play04:52

this

play04:53

and let's go back to our code and for

play04:56

the heading we have this s3 over here

play04:59

so let's style that

play05:01

so here i'll just type courses section

play05:04

course card

play05:06

s3 and i'll just copy the styles

play05:10

and let's remove this color and let's

play05:11

add our variable over here so i'll just

play05:14

have var

play05:15

dark blue color and i'll just remove

play05:17

this comment and font style and also add

play05:20

sans serif over here

play05:24

right now let's go back to our browser

play05:26

and here we can see we have the styling

play05:27

for the heading now the next thing we

play05:29

will do is we want this heading and this

play05:31

duration to be one next to the other so

play05:33

for that we have to add a display of

play05:35

flex to the parent division so if you go

play05:37

back to our html

play05:39

here we can see we have this division of

play05:40

the class of info

play05:42

and in that we have this s3 and the

play05:43

duration so we will set a display of

play05:45

flex to this info division so let's go

play05:47

back

play05:49

and here i'll just type

play05:50

courses section course card

play05:53

info

play05:54

and here let's tap display of flex

play05:57

and let's go back to our figma file and

play05:59

let's see what is the gap that we have

play06:00

over here

play06:02

so if i press option or alt we can see

play06:04

we have a gap of 16 pixels

play06:08

so let's add that gap over here so i'll

play06:09

just type gap of 16 pixels

play06:12

and the next thing we will do is we'll

play06:14

position them to the left and to the

play06:15

extreme right so i'll just type justify

play06:17

content and space between

play06:20

and i will also

play06:22

bring it to the center vertically so

play06:23

i'll just type align items to the center

play06:25

all right now let's go back to our

play06:26

browser

play06:27

and now we can see we have the heading

play06:29

on the left and the duration on the

play06:31

right all right now let's add the

play06:32

styling for the duration so let's go

play06:34

back to the figma file

play06:36

and let's double click over here

play06:39

and here we can see the styles for the

play06:41

duration so i'll just copy these

play06:44

and let's go back to our code

play06:46

and for the duration we have this

play06:48

division of the class of duration

play06:50

so i'll just add that over here

play06:53

i'll just type courses section

play06:55

course card

play06:56

duration

play06:57

and here i'll just paste the code

play07:00

and let's change this color to the dark

play07:03

variable so i'll just type dark blue

play07:05

color

play07:06

and i'll just delete this comment and

play07:08

this style and i'll just add sensative

play07:11

over here

play07:13

all right now let's go back to our

play07:14

browser and here we can see we have the

play07:16

styling for the duration but here in the

play07:19

duration we have this uh 15 written over

play07:22

here at the top and ours written over

play07:24

here at the bottom so we have this in

play07:26

two different lines now we want to have

play07:27

both of these in the same line so let's

play07:30

go back

play07:31

and here we need to add a line of code

play07:33

which is white space

play07:36

no wrap

play07:39

right now if we go back to our browser

play07:41

here we can see we have 15 hours written

play07:43

in the same line right now the next

play07:45

thing we will do is we will add the

play07:47

clock symbol over here on the left of

play07:49

the duration so if you go back to our

play07:51

figma file here we can see we have this

play07:53

symbol over here so here i'll just type

play07:57

courses section

play07:58

course card duration

play08:00

and we will use a before selector so

play08:02

i'll just type before

play08:04

and for the content i'll just type the

play08:06

url of the image

play08:08

so let's type url so here i'll just type

play08:11

images slash and the image is called

play08:13

clock.svg now let's go back to our

play08:15

browser and now we can see we have this

play08:18

clock image over here now we will add

play08:20

some more styles over here to position

play08:21

it correctly so we'll position this

play08:23

relative to this duration over here so

play08:25

here i'll just type position of relative

play08:29

and here we'll just type position

play08:31

absolute

play08:34

and we'll set the top position to

play08:37

2 pixels

play08:38

and we'll set the left position to

play08:40

negative 6 pixels

play08:42

let's see how it looks

play08:44

and now we can see it is in the correct

play08:45

position vertically but we need to have

play08:47

some padding over here on the left for

play08:50

this duration so let's go back

play08:52

and here for the duration i'll just have

play08:54

padding left

play08:56

and i'll just set a padding left of 20

play08:58

pixels

play08:59

let's go back

play09:00

and now we can see it looks alright so

play09:02

let's go back to our figma file

play09:04

and the next thing we will do is we will

play09:06

add this rectangle over here at the

play09:08

bottom of this course card so let's

play09:11

select this and here we can see the

play09:13

styling for this rectangle and i'll just

play09:15

select all of these lines of code from

play09:17

here and let's go back to our code

play09:21

and for this we will use an after

play09:22

selector

play09:24

so here just after the course card i

play09:27

just have courses section course card

play09:30

column column after

play09:32

and i'll set the content

play09:34

to blank

play09:36

and we'll just paste the css over here

play09:38

and we don't need to have this top over

play09:39

here so i'll just delete this line of

play09:41

code

play09:42

and i'll just set the right to 32 pixels

play09:45

so from the right we will have a spacing

play09:47

of 32 pixels and from the left also we

play09:49

will have a spacing of 32 pixels and

play09:51

from the bottom we will have a spacing

play09:53

of 0

play09:55

and we have a height of 8 pixels and

play09:57

we'll set the color to the dark color so

play10:00

i'll just tap var

play10:01

dark blue color now we need to set the

play10:04

position of this after selector relative

play10:07

to this course card so here i'll just

play10:09

type position

play10:10

relative and here i'll just type

play10:12

position absolute

play10:15

right now let's go back to our browser

play10:17

and now you can see we have this

play10:19

rectangle over here and it looks all

play10:21

right now the last thing we need to

play10:22

style is this button so we need to bring

play10:24

this button over here to the right so

play10:26

for that let's go back to our code and

play10:30

we will position the button relative to

play10:32

this rapid division so let's go back and

play10:34

we will select the wrapper inside the

play10:36

courses section so here we can see in

play10:38

the courses section we have this wrapper

play10:40

so here i'll just type courses section

play10:43

wrapper and i'll just set the position

play10:45

to relative

play10:48

and now let's select the button so for

play10:49

the button we have a class of btn

play10:53

so let's select that

play10:55

here let's tap courses section

play10:58

wrapper

play10:59

btn

play11:00

and here i'll just have position

play11:02

absolute and set the right position to

play11:04

zero

play11:05

and now we can see the button is on the

play11:07

right now the last thing we need to do

play11:09

is we need to add some padding over here

play11:10

at the bottom so let's right click over

play11:12

here and click on inspect and let's

play11:14

select the wrapper or let's select the

play11:16

courses section

play11:18

and let's add some padding bottom

play11:21

so just have padding

play11:23

bottom

play11:25

and let's try some padding so let's

play11:26

start with 100 pixels

play11:29

i think we can increase the padding a

play11:30

little bit

play11:32

so i think

play11:33

120 pixels looks alright so let's add a

play11:36

padding bottom of 120 pixels for the

play11:38

courses section so let's go back

play11:41

and

play11:42

let's go to the courses section

play11:45

and here we will add a padding bottom

play11:48

of 120 pixels

play11:50

and let's go back to our browser and now

play11:52

we can see everything looks all right

play11:54

so with that we have completed the

play11:55

design of the hour courses section

play11:58

all right so that's it for this video

play12:00

you can find the link of the complete

play12:01

playlist in the description of this

play12:03

video and if you have any doubts you can

play12:04

ask in the comments below and if you

play12:06

like this video please click on the like

play12:07

button and subscribe to this channel to

play12:09

get the latest video updates thanks a

play12:11

lot for watching have a nice day

play12:15

[Music]

play12:29

you

Rate This

5.0 / 5 (0 votes)

Related Tags
Web DesignHTML CodingCSS TutorialJavaScriptWebsite DevelopmentFigma IntegrationResponsive LayoutCourse SectionTestimonial DesignHero SectionCoding Tutorial