CSS Course | CSS Position Property | Complete Web Development Course Beginner to Advance Tutorial 21

Coding Shuttle by Anuj Bhaiya
8 Oct 202216:39

Summary

TLDRThe video script discusses the importance of understanding CSS positioning properties for effective web design. It covers various position values like static, relative, absolute, fixed, and sticky, demonstrating how they affect the layout of web elements. The script provides practical examples, including creating a fixed navigation bar and manipulating element positions to enhance user experience. It also touches on the z-index property for stacking elements and encourages viewers to apply these concepts in their own web projects.

Takeaways

  • 😀 Positioning properties are crucial for correctly placing different elements within a website.
  • 📚 The 'position' property in CSS is essential for controlling the layout of elements on a webpage.
  • 🔍 Elements can have different behaviors like scrolling independently or being fixed in place, which is controlled by the 'position' property.
  • 🎨 There are several values for the 'position' property, including 'static', 'relative', 'absolute', 'fixed', and 'sticky'.
  • 📐 The 'static' position is the default, and elements with this setting do not move even when scrolled.
  • 🔄 'Relative' positioning places an element in relation to its normal position, allowing it to move within the parent container.
  • 🔒 'Absolute' positioning takes an element out of the normal document flow and positions it in relation to the nearest positioned ancestor.
  • 📍 'Fixed' positioning places an element relative to the browser window, making it stay in the same place even when the page is scrolled.
  • 🍃 'Sticky' positioning is a hybrid of 'relative' and 'fixed', where the element sticks to a certain position on the page as you scroll.
  • 🛠️ Understanding and using the 'position' property effectively can greatly enhance the layout and user experience of a website.
  • 🔑 The 'z-index' property also plays a role in stacking elements on top of one another, especially when combined with positioning.

Q & A

  • What is the main topic discussed in the script?

    -The main topic discussed in the script is the concept of positioning properties in web design, specifically how to properly position different elements within a website.

  • What are some common issues with website elements that the script aims to address?

    -The script aims to address issues such as elements that scroll while others do not, and how to fix the positioning of various website elements to achieve the desired layout.

  • What is the default value of the position property in CSS, and what does it mean?

    -The default value of the position property in CSS is 'static', which means that an element is positioned according to the normal flow of the document (it is not shifted from its original position).

  • What are the different values of the position property mentioned in the script?

    -The script mentions 'static', 'relative', 'absolute', 'fixed', and 'sticky' as different values of the position property.

  • How does the 'relative' value for the position property affect an element's position?

    -The 'relative' value positions an element relative to its normal position, allowing it to be shifted from the document flow without affecting the position of other elements.

  • What is the purpose of the 'absolute' position value?

    -The 'absolute' position value positions an element relative to its nearest positioned ancestor, if any; otherwise, it positions the element relative to the initial containing block.

  • How does the 'fixed' position value differ from 'absolute'?

    -The 'fixed' position value positions an element relative to the browser window (or the nearest scrolled ancestor), meaning it will not move even if the page is scrolled.

  • What is the 'sticky' position value used for?

    -The 'sticky' position value positions an element based on the user's scroll position. It is positioned relative to the viewport and will stick to a certain position when the user scrolls a certain amount.

  • What is the role of the 'z-index' property in relation to positioning?

    -The 'z-index' property determines the stack order of an element, which is important when elements overlap. It does not affect the actual position of the element on the x and y axes.

  • How can one ensure that a positioned element does not overlap with others?

    -One can ensure that a positioned element does not overlap with others by adjusting its 'z-index' property and by carefully planning the layout to avoid overlap.

  • What is the script's suggestion for creating a new bar in a website layout?

    -The script suggests defining the height and position properties of the new bar to be 'fixed' and 'top zero', respectively, to ensure it remains at the top of the page regardless of scrolling.

Outlines

00:00

📚 Understanding Positioning Properties in Web Design

This paragraph discusses the importance of understanding positioning properties in CSS for effective web design. It explains how correct positioning can help in placing various elements within a website, such as fixed headers, scrollable content, and elements that do not scroll. The speaker uses examples like a YouTube playlist and a website's sidebar to illustrate the concept of different positioning properties, such as static, relative, absolute, fixed, and sticky. They also mention how to create a container with a specific class and style it with various properties like margin, height, and background color. The paragraph ends with a teaser for the next video, which will involve creating a dummy website with a new bar.

05:02

📐 Mastering Positioning Techniques for Advanced Layout Control

The speaker delves deeper into the positioning properties, explaining the differences between relative, absolute, and fixed positioning. They demonstrate how to manipulate an element's position using top, left, bottom, and right properties in relation to its parent container. The concept of negative values for these properties is introduced, allowing elements to move outside their parent's boundaries. The paragraph also covers how to center an element within its parent using a combination of top, left, and specific pixel values. An example of absolute positioning is given, where an element is taken out of the normal flow and placed exactly where needed, regardless of other elements. The speaker also explains the concept of fixed positioning, where an element remains in a fixed position on the screen even when scrolling.

10:03

🔄 Exploring Sticky Positioning and Its Effects on Scrolling

This section focuses on the sticky positioning property, which allows an element to stick to the viewport during scrolling until it reaches a certain point, after which it behaves like a static element. The speaker creates a new box and applies the sticky property to demonstrate how it works in relation to its parent container. They explain that as the user scrolls, the sticky element will remain in view until it reaches the parent's boundary, at which point it will become static. The paragraph also touches on the absolute positioning in relation to the root element and how it differs from relative positioning, which is always in relation to the parent element.

15:03

🎨 Applying Positioning to Create Dynamic and Responsive UI Elements

The final paragraph discusses how to use positioning to create dynamic user interface elements. The speaker talks about setting the z-index property to control the stacking order of elements, ensuring that certain elements always appear on top or below others. They also mention the use of the float and clear properties to handle the layout of elements, especially when dealing with issues like not being able to align an element to the right side. The paragraph concludes with a homework assignment for the viewers to create a layout based on a provided HTML structure, encouraging them to experiment with different positioning techniques to achieve the desired design.

Mindmap

Keywords

💡Position Property

The 'Position Property' in CSS is a key concept in the video, which defines how an element is positioned in a document. It's crucial for understanding how elements can be placed differently on a webpage, such as fixed, relative, absolute, or static positioning. The video discusses various position values like 'static', 'relative', 'absolute', 'fixed', and 'sticky', and how they affect the layout, as seen when elements remain fixed or scroll with the page.

💡Scroll

In the context of the video, 'Scroll' refers to the action of moving through content on a webpage that is longer than the visible area. It is an important concept because it relates to how positioned elements behave when the user scrolls. For instance, some elements might remain fixed at the top while others scroll with the page, which is controlled by the position property.

💡Container

A 'Container' in the video script refers to a part of the webpage that can hold other elements, such as boxes, and can be styled with CSS properties. Containers are essential for organizing content and applying positioning styles, as demonstrated when creating a dev container to hold boxes with different background colors.

💡Box

'Box' is used in the script to represent an element within the container that can be styled and positioned. The video discusses creating boxes with different colors and positioning them using various CSS properties to demonstrate how elements can be arranged on a webpage.

💡Static Positioning

Static positioning is the default positioning of an element and is mentioned in the script as the basis for understanding other positioning schemes. Elements with static positioning are laid out in the order they appear in the HTML document and do not move when scrolled, serving as a reference point for the other position properties discussed in the video.

💡Relative Positioning

Relative positioning is a type of CSS positioning where an element is positioned relative to its normal position. In the video, it's used to demonstrate how elements can be moved from their original location by a certain distance, using properties like top, left, bottom, and right, without affecting the layout of other elements.

💡Absolute Positioning

Absolute positioning in the video is explained as a method where an element is taken out of the normal document flow and positioned at a specific position relative to its nearest positioned ancestor. This is showcased through examples in the script where elements are positioned absolutely within a container, allowing for precise placement without affecting the position of other elements.

💡Fixed Positioning

Fixed positioning is a CSS property used to fix an element at a specific place on the screen, regardless of scrolling. The video script uses this concept to illustrate how certain elements, like a fixed navbar, can remain in the same place even when the user scrolls the page.

💡Sticky Positioning

Sticky positioning is a concept where an element is treated as 'relative' until it reaches a certain scroll position, after which it becomes 'fixed'. The video script explains this by showing how an element can stick to the viewport at a specified scroll location, enhancing user experience by keeping certain elements accessible.

💡CSS

CSS (Cascading Style Sheets) is the language used for describing the presentation of a document written in HTML. Throughout the video script, CSS properties are used to style and position elements on the webpage, demonstrating its importance in web design for creating visually appealing and functional layouts.

💡Viewport

The 'Viewport' in the video script refers to the visible area of a web page that a user can see at any given moment. It's relevant when discussing fixed and sticky positioning, as these properties position elements in relation to the viewport, ensuring they remain visible or behave as intended during scrolling.

💡HTML

HTML (HyperText Markup Language) is the standard markup language for creating web pages. The script mentions HTML in the context of creating elements like sidebars, headers, and footers, which are then styled and positioned using CSS, highlighting the collaborative role of HTML and CSS in web development.

💡S-index

While 'S-index' is not a standard term in web development, it seems to refer to an index or stacking order of elements in the video script. It's used to explain how elements can be stacked on top of one another, with the 'z-index' property determining which element appears on top, which is crucial for layering elements in web design.

Highlights

Discussing the importance of CSS positioning properties for effectively positioning different elements within a website.

Explanation of how some website elements scroll while others remain fixed without scrolling, due to different position properties.

Introduction to the concept of 'position' property in CSS and its various values like static, relative, absolute, fixed, and sticky.

Demonstration of how to use the 'position' property to fix a website's header at the top, making it remain in place even when scrolling.

Creating a container and boxes with different colors to visually demonstrate the effects of applying various position properties.

Using the 'relative' value to position elements in relation to their normal position, causing them to shift from where they would normally be.

Applying the 'absolute' value to take an element out of the normal document flow and position it in relation to its nearest positioned ancestor.

The 'fixed' value is used to position an element relative to the browser window, keeping it in the same place even when scrolling the page.

Explanation of the 'sticky' position value, which acts like a combination of relative and fixed, positioning an element based on the user's scroll position.

Creating a practical example of a webpage layout with a fixed header, side navigation, main content area, and footer using CSS positioning.

How to adjust the position of elements using top, left, right, and bottom properties in combination with the position property.

Using negative values with the top, left, right, and bottom properties to move elements in the opposite direction.

The impact of the 'z-index' property on the stacking order of positioned elements, with higher z-index values bringing elements to the front.

How to center a positioned element within its container using a combination of margin and position properties.

Tips for troubleshooting common issues related to positioning, such as overlapping elements or elements not staying in place.

The importance of considering the viewport and user experience when deciding on the position properties and values to use for different elements.

A step-by-step guide to building a CSS layout with a fixed navigation bar, main content area, and footer, demonstrating the practical application of positioning.

How to use CSS comments to organize and explain the positioning code, making it easier to understand and maintain.

The role of CSS positioning in creating responsive and adaptive web designs that work well on different screen sizes and devices.

Transcripts

play00:03

बिगनर्स लेकर एडवांस साल तक पढ़ रहे हैं

play00:05

आज हम बात करने वाले हैं कस के अंदर

play00:08

पोजीशन प्रॉपर्टी के बारे में और ये एक

play00:10

बहुत ही इंपॉर्टेंट प्रॉपर्टी होती है

play00:11

इसको ठीक से समझेंगे इसकी हेल्प से आप लोग

play00:13

अपनी वेबसाइट के अंदर डिफरेंट डिफरेंट

play00:14

एलिमेंट्स को ठीक से पोजीशन कर सकते हो

play00:16

आपने कई बार देखा होगा वेबसाइट के अंदर की

play00:18

कुछ चीज तो स्क्रॉल कर रही हैं कुछ चीज

play00:20

स्क्रॉल नहीं करें जैसे इस यूट्यूब के

play00:22

अंदर हमारी प्लेलिस्ट ऐप इसको जाके बुक

play00:23

मार्क कर लीजिएगा वैसे यहां पर आप देख रहे

play00:25

हो नव बार जो है ये स्क्रॉल नहीं कर रहा

play00:27

है सिमिलरली लेफ्ट में जो ये पूरा पार्ट

play00:29

है ये स्क्रॉल नहीं कर रहा अगर मैं यहां

play00:30

पर स्क्रॉल कर रहा हूं तो ये कैसे हो का

play00:33

रहा है ये सब कुछ डिफरेंट डिफरेंट पोजीशन

play00:34

की प्रॉपर्टीज की वजह से हो का रहा है ये

play00:36

वाला पार्ट अलग स्क्रॉल कर रहा है ये नया

play00:37

बार ऊपर फिक्स्ड हो रखा है तो ये सब मास

play00:39

देख रहे होंगे की किस तरीके से ये

play00:41

पोजिशनिंग कम करती है और अगली वीडियो में

play00:43

हम बना रहे होंगे ऐसा कुछ जहां पर हम एक

play00:45

डमी वेबसाइट बना रहे होंगे जहां पर हमारे

play00:47

पास एक नया बार होगा आपने देखा होगा इस

play00:49

टाइप का कंटेंट काफी बार दिखता है की एक

play00:51

नया बार होता है एक साइड बार होता है बेबी

play00:52

यहां पर एडवर्टाइजमेंट चल रहा है अभी मैं

play00:54

आपने देखा होगा की यहां पर प्राइस लिखा

play00:57

होता है किसी कोर्स का यहां पर प्राइस

play00:58

यहां पर कोर्स का आपका कंटेंट होता है

play01:00

यहां पर हो सकता कोई बटन हो जिससे आप

play01:02

कॉन्टैक्ट कर सकते हो यूजर हेल्पलाइन नंबर

play01:04

वगैरा कुछ भी हो सकता है दें आप स्क्रॉल

play01:05

करोगे तो ये वाली चीज यहीं पे रहेंगे आपका

play01:08

में कंटेंट्स रोड पर रहेगा एंड दें हो

play01:10

सकता है कुछ देर बाद ये भी सॉल्व करने लग

play01:11

जाए राइट तो आफ्टर सैम टाइम ये वाला पार्ट

play01:13

भी स्क्रॉल करने लग गया और ये ऊपर पहुंच

play01:14

जाए एंड दें आपका नीचे यहां पर फोटो आता

play01:16

है तो ये सब चीज कैसे कम कर रही हैं ये सब

play01:19

समझ रहे होंगे क्योंकि अगर आप लोग सिंपल

play01:21

एचटीएमएल के अंदर लिख दोगे ना नया साइड

play01:23

फुटर हेडर तो उससे कुछ होने वाला नहीं है

play01:26

क्योंकि एचटीएमएल के अंदर बाय डिफॉल्ट जो

play01:29

पोजिशनिंग होती है वो होती है स्टैटिक तो

play01:30

पोजीशन प्रॉपर्टी को समझना जरूरी है

play01:32

पोजीशन प्रॉपर्टी के अंदर और भी बहुत सारी

play01:33

वैल्यू होती है आप देख रहे हो यहां पर

play01:34

लिखा हुआ है डिफॉल्ट वैल्यू होती है

play01:36

स्टैटिक तो बाय डिफॉल्ट सब कुछ स्टैटिक

play01:37

मिला होता है लेकिन स्टैटिक के अलावा

play01:39

रिलेटिव एब्सलूट फिक्स्ड एंड स्टिकी ये

play01:42

चार प्रॉपर्टी और होती है जिनको समझना

play01:44

जरूरी होता है तो इनको समझ रहे होंगे तो

play01:45

इसके लिए तो अपने कोड के अंदर और यहां पर

play01:47

कुछ कुछ टिप्स बना लेते हैं तो सबसे पहले

play01:49

बनाऊंगा देव कंटेनर हम तो इसको ऐसे नहीं

play01:52

मारते हैं ऐसे करते हैं

play01:55

डॉट कंटेनर और इसके अंदर हम बनाएंगे

play02:07

बॉक्स क्लास के यहां पर यह बैक स्पेस

play02:10

वगैरा इंटर वगैरा लिखा रहे क्योंकि इसके

play02:11

अंदर मैंने एक कास्ट स्क्रैनकास्ट मोड

play02:14

इनेबल कर दिया हमारे एक सब्सक्राइबर ने

play02:16

कमेंट करके कहा था तो यह बहुत एक अच्छा

play02:18

टूल लगा मुझे जिससे की आपको समझ में आएगा

play02:20

की मैं कैसे चीजे कमेंट वगैरा करता हूं तो

play02:22

क्या लिख रहा हूं मैं ठीक है कमांड स्लैश

play02:24

कमांड स्लैश ये सब चीज ये सब दिखती रहेंगी

play02:26

आपको अगर अनाेईंग लग रही है तो बता देना

play02:28

मुझे मैं हटा दूंगा इन सब चीजों को आपको

play02:30

यहां पर रेड रेड कलर के ऊपर भी दिख रहा

play02:32

होगा ये सब उसी की वजह से हो रहा है ठीक

play02:34

है ठीक है आगे बढ़ते हैं हम यहां पर हमारे

play02:36

पास एक कंटेनर है और एक बॉक्स है इन सभी

play02:38

बॉक्स को मैं कुछ और क्लासेस भी दे सकता

play02:39

हूं लेट्स से रेड

play02:43

ग्रीन एंड

play02:46

ब्लू

play02:48

देते हैं कुछ कुछ तो इसको मैं हक कर देता

play02:51

हूं साइड में एंड दें हमारे पास होगा एक

play02:52

कंटेनर

play02:54

इसकी विथ हाइट डिफाइन कर लेता है 300

play02:57

पिक्सल और हाइट

play03:12

और बैकग्राउंड कलर यह तीनों चीज मुझे देनी

play03:15

है इनको तो मैं कॉपी करूंगा

play03:26

नहीं है रेड उसको मैं रेड के लिए अलग कलर

play03:29

दूंगा इसका कलर होगा रेड ठीक है

play03:36

लेकिन अभी देखते हैं कैसा दिख रहा है तो

play03:39

मैं इसको करूंगा

play03:41

है और यहां पर हमें इस तरह इसको साइड बाय

play03:44

साइड लेकर ए जाते हैं तो यहां पर हमारे

play03:45

पास एक कंटेनर है ग्रे कलर का इसके अंदर

play03:47

एक रेड बॉक्स है दें हम ग्रीन बॉक्स में

play03:50

डालेंगे इसके अंदर तो ग्रीन

play03:53

बैकग्राउंड कलर उसका हो जाएगा ग्रीन

play03:56

एंड दें एक होगा हमारे पास ब्लू

play04:01

उसका बैकग्राउंड कलर हो जाएगा ब्लू

play04:04

तो ये हमें कुछ इस तरीके से दिखाई दे रहा

play04:06

है अब एक कम और करते हैं की यहां पर अपने

play04:08

कंटेनर को मार्जिन और दे देते हैं थोड़ा

play04:10

सा लेट से 100 पिक्सल का तो चारों साइड ये

play04:14

दूर ए जाएगा और ये भी फिलहाल कुछ इस तरीके

play04:16

से दिख रहा है अब यहां पर हम कुछ-कुछ चीज

play04:18

करते हैं फॉर एग्जांपल अगर मैं यहां पर

play04:20

पोजीशन लिखूंगा आपको पोजीशन दिखाता हूं

play04:21

पोजीशन अगर मैं कुछ नहीं लिखूंगा तो बाय

play04:24

डिफाल्टर स्टैटिक होता है तो मैं अगर कुछ

play04:25

भी लिखूंगा तो भी ये स्टैटिक है स्टैटिक

play04:26

आपको दिख रहा होगा की कुछ भी फर्क नहीं

play04:28

पड़ा लेकिन इसके अलावा अगर मैं यहां पे

play04:30

लिखूंगा रेड

play04:31

तो भी आप रेड को कुछ फर्क पड़ा बीपी वैसे

play04:34

के वैसा ही है तो पोजीशन ऐसे कुछ फर्क

play04:36

नहीं पड़ता क्वेश्चन में लिखने के बाद तो

play04:37

फिलहाल रिलेटिव का मतलब है रिलेटिव तू डी

play04:40

पैरेंट और पैरेंट हमारा ये कंटेनर है राइट

play04:42

तो इसके रिलेटिव मैं बता सकता हूं की किधर

play04:44

जाना है आपको टॉप राइट बॉटम और लेफ्ट ये

play04:46

चार फुल होते हैं की इनके साफ-सा आपको

play04:48

कहां जाना है तो मैं बताऊंगा इसको ठीक है

play04:50

टॉप से आप चले जाओ 50 पिक्सल नीचे

play04:54

ठीक है तो आप देखोगे की हुआ क्या ये जो

play04:57

रेड वाला बॉक्स है ये टॉप से 50 पिक्सल

play04:59

नीचे ए गया है सिमिलरली मैं इसको कर सकता

play05:01

हूं लेफ्ट से 50 पिक्सल आगे

play05:05

है तो आप देखोगे की लेफ्ट साइड इधर चला

play05:08

गया

play05:10

विचार टॉप लेफ्ट दें राइट राइट लिखकर

play05:15

लिखता हूं हंड्रेड

play05:19

पढ़ा नहीं तो मैं कम करता हूं यहां से मैं

play05:22

लेफ्ट को हटता हूं और आपको तब दिखाई देगा

play05:24

राइट कैसे कम कर रहा है तो आप देख रहे हो

play05:26

राइट इसका यहां पर था रेड वाले का राइट

play05:28

कॉर्नर ये था ये इस राइट कॉर्नर से 100

play05:32

पिक्सल राइट साइड ए गया राइट इस राइट वाली

play05:34

जगह से 100 पिक्सल राइट साइड चला गया तो

play05:37

बेसिकली इसका मतलब यही होता है टॉप लेफ्ट

play05:38

राइट बॉटम का की आप टॉप से कितना नीचे ए

play05:41

रहे हो लेफ्ट से कितना आगे जा रहे हो राइट

play05:43

से कितना इधर ए रहे हो और बॉटम से कितना

play05:44

ऊपर जा रहे हो ठीक है अगर मैं यहां पर टॉप

play05:46

की जगह लिख देता हूं लेट्स से बहुत कम

play05:49

तो बॉटम इसका मतलब क्या हुआ की बॉटम यह

play05:52

थायराइड रेड यहां पर था पहले और इसका बॉटम

play05:54

यह था इससे यह 50 पिक्सल ऊपर चला गया यहां

play05:57

पर नेगेटिव वैल्यू इसमें डिफाइन होती है

play05:58

इसका मतलब मैं आप अगर लिखूंगा माइंस 50

play06:00

पिक्सल तो क्या होगा ये बॉटम यहां था राइट

play06:03

इस बॉटम से ये नेगेटिव 50 की पिक्सल मतलब

play06:06

की नीचे की साइड 50 पिक्सल चला गया ठीक है

play06:09

तो यहां पर आप लोग नेगेटिव कहीं डिफाइन

play06:11

करोगे इसकी वजह यहां पे आप लिख सकते हो

play06:12

टॉप से 50 पिक्सल राइट वो भी से कम करेगा

play06:15

तो इस तरीके से आप लोग टॉप लेफ्ट राइट और

play06:17

बॉटम डिफाइन कर सकते हो एक बार आपने बता

play06:19

दिया की पोजीशन रिलेटिव है इसका मतलब

play06:21

रिलेटिव तू डी पैरेंट मुझे कम करना है तो

play06:23

इस तरीके से आप डब्बे को बाहर ले सकते हो

play06:25

अंदर कहीं भी ले सकते हो इसके बाद अगर

play06:27

आपको इस डब्बे को सेंटर में एलाइन करना है

play06:28

तो कैसे करोगे हमें पता है ये 300/300 का

play06:31

है तो मुझे करना क्या है मुझे टॉप से लेके

play06:33

आना है इसे 100 पिक्सल नीचे तो मैं टॉप्स

play06:36

लिखूंगा इसे 100 पिक्सल नीचे

play06:38

यादव पिक्सल नीचे एंड दें मुझे लेफ्ट से

play06:41

इसको ले जाना है 100 पिक्सल राइट साइड में

play06:43

तो लेफ्ट से हंड्रेड पिक्सल रेड वाला

play06:48

बॉक्स हमारे इस बॉक्स के सेंटर में ए गया

play06:49

इस तरीके से हमारा पोर्शन रिलेटिव कम करता

play06:51

है अब जरा बात करते हैं पोजीशन एब्सलूट के

play06:54

बारे में तो मैं आपसे करता हूं ग्रीन को

play06:55

देता हूं पोजीशन एब्सलूट

play06:58

पोजीशन एब्सलूट तो यह मैंने ग्रीन को जब

play07:01

क्वेश्चन

play07:02

हुआ और हुआ क्या की ब्लू वाला बॉक्स गायब

play07:05

हो गया तो एक्चुअली होता क्या है ना जब आप

play07:07

लिखते हो पोजीशन एब्सलूट तो वो आपके

play07:09

एचटीएमएल के नॉर्मल फ्लोर से बाहर निकल

play07:11

जाता है और अब ये ऐसे ही बस फ्लैट कर रहा

play07:13

है बीच में कहीं भी ठीक है जहां पर इसको

play07:15

जगह थी जहां पर ये पहले था ये उसी जगह पे

play07:17

खड़ा हो गया और ये बेसिकली ये अपने में

play07:20

एचटीएमएल से बाहर निकल चुका है मैं क्या

play07:22

कहना चाह रहा हूं की अगर आप इसको यहां से

play07:23

हटा भी दोगे ना ये सब उसके लिए हमारा

play07:25

ग्रीन बॉक्स है इसको मैं यहां से हटा देता

play07:27

हूं तो मैं शो करूंगा कमेंट

play07:29

तो आप देखोगे ग्रीन बॉक्स है गया और उसके

play07:32

नीचे आपका ए गया ब्लू बॉक्स तो ये ब्लू

play07:34

बॉक्स इस तरीके से ऊपर ए गया की कभी यहां

play07:35

पर ग्रीन बॉक्स था ही नहीं मेरी बात समझ

play07:37

रहे हो मैं वापस से इसको दल दूंगा तो ये

play07:39

बस ऊपर रख जाएगा क्यों राखी जाएगा क्योंकि

play07:41

यह पोजीशन एब्सलूट हो राखी है और पोजीशन

play07:43

एब्सलूट कम करती है आपकी एचटीएमएल के साथ

play07:45

ठीक है तो रिलेटिव का रिलेटिव होता है

play07:47

पेरेंट्स वहीं पे एब्सलूट का रिलेटिव होता

play07:49

है एचटीएमएल एचटीएमएल विच इसे डी होल

play07:51

पैरेंट जो पूरा का पूरा रूट एलिमेंट है

play07:53

यहां पे तो यहां पर हम इस रूट एलिमेंट के

play07:55

साथ टॉप लेफ्ट बॉटम डिफाइन कर सकते हैं तो

play07:57

सपोज करो यहां पर टॉप जीरो तो इसका मतलब

play07:59

पैरेंट के साथ टॉप में जीरो ए चुका है ये

play08:02

ठीक है और अगर लेफ्ट 0 तो आप देखोगे की जो

play08:07

पैरेंट है आपका बेसिकली ये जो रूट एलिमेंट

play08:09

है उसके साथ ये लेफ्ट से जीरो है और टॉप

play08:12

से जीरो है इस तरीके से आप इसको कहीं भी

play08:13

ले सकते हो सपोज यहां के जाना है बॉटम

play08:16

राइट कॉर्नर में लेके आना है तो इसके लिए

play08:17

मैं लिखूंगा

play08:19

बॉटम से जीरो डिस्टेंस दूर और राइट से भी

play08:24

जीरो डिस्टेंस दूर ठीक है तो राइट वाली

play08:26

साइड अपने पेरेंट्स से जीरो डिस्टेंस दूर

play08:28

है और बॉटम वाली साइड अपने पैरेंट के बॉटम

play08:30

से जीरो डिस्टेंस दूर है इस तरीके से ये

play08:32

एब्सलूट कम करता है तो ये हो गया आपका

play08:34

एब्सलूट इसके बारे में भी हम थोड़ी और बात

play08:35

करेंगे लेकिन आप पहले बात करते हैं यहां

play08:37

पर हम फिक्स्ड वैल्यू के बारे में तो मैं

play08:39

उसके लिए लिखूंगा ब्लू वाले को पोजीशन

play08:42

फिक्स्ड और फिक्स पोजीशन करता क्या है ना

play08:45

की इसको स्क्रीन पे इस जगह पे फिक्स कर

play08:47

देगा तो आप चाहे कहीं भी स्क्रॉल कर दो ये

play08:49

यहीं पे फिक्स रहने वाला है अब तो उसके

play08:51

लिए मैं आपको डेमोंस्ट्रेट करने के लिए कम

play08:52

करता हूं यहां पे एक बनाता हूं

play08:55

देव ठीक है और

play08:58

इसको मैं

play09:01

स्पेशल

play09:05

300

play09:06

यहां पर थोड़ा स्क्रॉल करने के लिए हमारे

play09:09

पास और आप देख रहे हो

play09:12

इस जगह फिक्स हो गया क्यों फिक्स हो गया

play09:15

क्योंकि इसकी पोजीशन मैंने डिफाइन कर दिया

play09:16

फिक्स तो अब ये इधर ही फिक्स रहेगा आप

play09:18

बोलोगे भैया मुझे इधर फिक्स नहीं करना

play09:20

मुझे इधर लेफ्ट साइड चिपकाना है तो भी कोई

play09:22

बात नहीं क्योंकि ये रिलेटिव तू डी रूट कम

play09:24

कर रहा है तो यहां पर हम लिख सकते हैं

play09:25

लेफ्ट

play09:27

जीरो तो यह लेफ्ट साइड में इधर ए गया और

play09:30

अगर मैं आप लिख दूंगा टॉप जीरो

play09:33

इधर फिक्स हो जाने वाले अगर मैं कुछ भी

play09:36

स्कूल करूं यह यहीं रहने वाला हूं ठीक है

play09:40

नया बार बनाओ उसकी हाइट को डिफाइन कर दो

play09:43

कुछ भी और डिफाइन कर दो 100% एंड दें उसकी

play09:47

पोजीशन को कर दो फिक्स और टॉप में कर दो

play09:49

जीरो तो ये हमेशा के लिए फिर टॉप में अटक

play09:51

जाने वाला है और ये कहीं भी मिल जाएगा ठीक

play09:53

है या फिर अगर आपको बनाना है कुछ ऐसा टाइप

play09:56

का की आपको ऐसा कुछ बटन बनाना है जिसको आप

play09:58

हमेशा फिक्स रखना चाहते हो तो इसको भी आप

play10:00

हमेशा फिक्स रख सकते हो आप इसको लेफ्ट और

play10:02

राइट से कुछ पेंडिंग दे दो या फिर पेंडिंग

play10:04

ना देखें आप यहां पर से टॉप और लेफ्ट

play10:06

डिफाइन कर सकते हो फ्रेंड्स एग्जांपल मैं

play10:08

चाहता हूं ये इधर आए बॉटम कॉर्नर में है

play10:09

तो मैं लिखूंगा यहां पर

play10:13

50 पिक्सल एंड

play10:18

राइट में

play10:22

इसका मतलब यहां पर आने

play10:24

जाएगा

play10:36

पुरी स्क्रीन में और वो कहीं नहीं जाने

play10:39

वाला है वहीं पर रहेगा हमेशा इसके अलावा

play10:41

एक होता है स्टिकी अब देखते हैं जरा

play10:42

स्टिकी कैसे कम करता है स्टिकी को समझने

play10:45

के लिए मैं कम करता हूं एक और बॉक्स बनाता

play10:46

हूं और एक नया बॉक्स बनाएंगे हम

play10:50

है जिसका मैं नाम देता हूं लेट से पर्पल

play10:55

और इसको हम बनाएंगे यहां पर

play11:02

इसको बैकग्राउंड कलर देते हैं पर्पल और

play11:05

यहां पर यह

play11:07

करते हैं इस पर्पल बॉक्स को बनाते हैं

play11:10

स्टिकी बनाने से होता क्या है

play11:13

लेकिन जैसे-जैसे करके आप इसे स्क्रॉल करते

play11:15

हो जैसी करके आपको पैरेंट बाहर निकल जाता

play11:17

है आपके व्यू से तो उसी टाइम पर ये स्टिकी

play11:20

वाला चीज भी अपने बाहर निकल जाता है ये

play11:22

आपको मैसेज samjhaunga समझ में नहीं आएगा

play11:23

लेकिन जब हम देखेंगे इसे तो आप बोलोगे ठीक

play11:26

है जैसे की पोजीशन इसी की हम कर देते हैं

play11:30

स्टिकी इसके बाद आपको बताना पड़ेगा स्टिक

play11:32

कैसे करना है मतलब पैरेंट के हिसाब से

play11:34

कितनी दूर पर स्टिक करना है तो मैं चाहता

play11:36

हूं की पैरेंट तो ठीक है यहां पर है और

play11:38

पैरेंट के हिसाब से टॉप से लत से 50

play11:42

पिक्सल आप इसे स्टिक कर दो ठीक है तो आप

play11:45

देखना

play11:48

तो यहां पर स्टिक

play11:51

ऊपर चला जाएगा

play12:05

ऊपर की साइड वैसे वैसे यहीं पर रहेगा

play12:08

स्टिक रहेगा स्टिक रहेगा एंड दें कुछ देर

play12:11

बाद

play12:12

चला जाएगा ठीक है तो इसी तरीके से मैंने

play12:16

ये वाली चीज बनाई है यहां पर आप देखोगे इस

play12:18

वाली चीज को मैं अगर यहां पर हमारा

play12:19

पेस्टिसाइड इनेबल कर डन तो आप देखोगे यह

play12:22

अभी तो ऊपर नहीं जा रहा अभी तो ऊपर नहीं

play12:24

जाएगा लेकिन जैसे इसको यहां पर ये पैरेंट

play12:25

मिलेगा पेरेंट्स नीचे से आया पैरेंट इसको

play12:27

अपने साथ ऊपर लेके चला जाएगा इस तरीके से

play12:29

ठीक है आपको समझ में ए रहा होगा की किस

play12:32

तरीके से स्टिकर कम कर रहा है तो यहां पर

play12:34

हमने स्टिकी को भी देख लिया लेकिन मैं

play12:36

आपको एब्सलूट के बारे में एक और चीज बताना

play12:37

चाहता हूं ये देखिए एब्सलूट बॉक्स है

play12:39

हमारा ग्रीन हमने अपलोड बनाया हुआ है और

play12:41

मैंने कहा था आपको की एब्सलूट कम करता है

play12:42

रिलेटिव तू डी रूट वेल ये एक्चुअली सही है

play12:45

नहीं ये एब्सलूट आपका रिलेटिव तू डी रूट

play12:47

कम नहीं करता ये रिलेटिव तू था वो वाला

play12:49

पैरेंट कम करता है जिसने अपनी पोजीशन को

play12:52

रिलेटिव बना रखा है अगर ये चीज समझ में

play12:54

नहीं आए तो मैं कम करता हूं आपको बताता

play12:55

हूं की लत से हम अपने कंटेनर को यहां पर

play12:57

बोल देते हैं पोजीशन

play13:00

रिलेटिव तो आप देखोगे ये ग्रीन बॉक्स अंदर

play13:02

ए गया पैरेंट के अंदर ए गया ऐसा क्यों हुआ

play13:04

क्योंकि ग्रीन बॉक्स देखता है की मेरा जो

play13:06

जस्ट पैरेंट है क्या उसकी पोजीशन रिलेटिव

play13:09

है अगर पोजीशन रिलेटिव नहीं है तो मैं

play13:11

उसके पैरेंट पे जाऊंगा और वहां चेक करूं

play13:13

क्या उसकी पोजीशन रिलेटिव है अगर रिलेटिव

play13:15

मिल गई तो मैं रिलेटिवली उसे कंटेनर के

play13:17

हिसाब से कम करूंगा इसका मतलब अगर आपको

play13:19

कोई कंटेनर मिल जाता है जिसका पोजीशन

play13:21

रिलेटिव है तो उसके अंदर ये वाला बॉक्स भी

play13:24

एब्सलूट नहीं रिलेटिव की तरह ही कम करेगा

play13:26

ठीक है तो एब्सलूट एलिमेंट अपने पेरेंट्स

play13:28

के अंदर ढूंढते रहेंगे की किसका पोर्शन

play13:30

रिलेटिव है और अगर कोई मिल गया तब तो उसके

play13:33

हिसाब से ये रिलेटिवली कम करेंगे अगर कोई

play13:35

नहीं मिला तो एचटीएमएल तो है तो ये सब का

play13:37

टॉप सबका रूट तो फिर ये उसके हिसाब से कम

play13:39

करेंगे ठीक है अगर मैं यहां से हटा दूंगा

play13:40

तो इसको कोई भी रिलेटिव नहीं मिलेगा

play13:42

पैरेंट तो ये जो टॉप पैरेंट होता है सबका

play13:44

मलिक एक विच इस एचटीएमएल उसके हिसाब से कम

play13:46

करेगा ये यहां पर आपको क्वेश्चन प्रॉपर्टी

play13:48

अच्छे से समझ में ए गई होगी एक कम और करते

play13:50

हैं इसको ठीक से डिफरेंशिएट करने के लिए

play13:53

की कौन सी चीज के अंदर हमने क्या

play13:54

प्रॉपर्टी लगा राखी है मैं कम करता हूं

play13:56

बॉडी

play13:58

और इसको कलर देते हैं लेट से

play14:01

व्हाइट और अब मैं यहां पर

play14:09

लिख दूंगा रिलेटेड

play14:27

का मतलब क्या होता है की कौन सा एलिमेंट

play14:29

आपका किस एलिमेंट के ऊपर ए रहा है आप यहां

play14:31

पर देख सकते हो फिक्स्ड आपका ग्रीन के ऊपर

play14:33

ए रहा है ऐसा क्यों हो रहा है तो वेल ये

play14:35

सब हो रहा है आपका स इंडेक्स की वजह से स

play14:37

इंडेक्स बाय डिफॉल्ट आपका कस के अंदर इस

play14:39

तरीके से कम करता है की जो आपके चिल्ड्रन

play14:41

होते हैं वो आपके पैरेंट के ऊपर ए रहे

play14:43

होते हैं आपने देखा ये पैरेंट हमने कंटेनर

play14:45

बनाया हुआ है ग्रे कलर का तो रिलेटिव

play14:48

एब्सलूट ऑफ फिक्स्ड ये सब इसके ऊपर ए गए

play14:49

हैं राइट और इसके अंदर इसी तरीके से चीज

play14:52

कम करते हैं एक के नीचे एक चीज से कम करते

play14:54

हैं स्टैटिक पोजीशन की तरह से और अगर आप स

play14:56

इंडेक्स की बात करोगे तो उसके अंदर

play14:58

चिल्ड्रन पैरेंट के ऊपर ए रहे होते हैं

play14:59

हमेशा ही लेकिन अगर आप इनको चेंज करना

play15:01

चाहते हो आप चाहते हो की नहीं मैं चाहता

play15:03

हूं कोई एलिमेंट किसी के नीचे ए जाए जैसे

play15:05

आप देख रहे हो फिक्स आपका इसके ऊपर ए रहा

play15:07

है मैं चाहता हूं की नहीं भाई ये ग्रीन

play15:09

वाला बॉक्स ऊपर है तो उसके लिए मुझे कुछ

play15:11

नहीं करना मैं आऊंगा यहां पर ग्रीन के

play15:12

अंदर और मेरे को यहां पर स इंडेक्स

play15:15

है और लेट सेवन

play15:17

तो यहां पर एब्सलूट अपने आप ऊपर ए गया मैं

play15:19

चाहता हूं

play15:24

यहां पर सेट इंडेक्स थोडासा बड़ा लिख

play15:26

दूंगा वैन से बड़ा

play15:29

सुपर ए गया तो इस तरीके से आप लोग डिफाइन

play15:32

करके बता सकते की कौन सी चीज अभी होनी

play15:34

चाहिए और कौन सी चीज टुवर्ड्स डी यूजर

play15:36

होनी चाहिए जिसका

play15:38

ज्यादा होगी जिसका होगा वो टुवर्ड्स डी

play15:41

यूजर कम होगी इस तरीके से ठीक है मैं यहां

play15:44

पर डिफाइन करूंगा अगर थ्री तो वापस ग्रीन

play15:46

बॉक्स ऊपर ए जाना चाहिए राइट इस तरीके से

play15:48

तो ये होगा आपका स इंडेक्स और आपने देखा

play15:50

पोर्शन किस तरीके से कम करता है इसके

play15:52

अलावा ये मैं आपको एक होमवर्क की तरह देता

play15:54

हूं ये आपका असाइनमेंट ऐप की ये इस टाइप

play15:55

का लेआउट बना कर दिखाओ इस पेज का एचटीएमएल

play15:57

में आपको दिखा देता हूं बाकी कस आप खुद

play15:59

बनाने का ट्राई करना तो एचटीएमएल कुछ इस

play16:01

तरीके से दिखता है की आपके पास एक नायब है

play16:02

खाली उसके अंदर एक में है में के अंदर एक

play16:05

पैराग्राफ है एक आपने दीप बना लिया है

play16:07

उसके अंदर एक साइड दल दिया है एक आपके पास

play16:10

है कॉन्टैक्ट वाला ये कॉन्टैक्ट वाला देबू

play16:13

है जो रेड कलर का बॉक्स दिख रहा था आपको

play16:15

एंड दें एक फुटर है इसके बाद तो आपको कस

play16:18

बनानी है सो डेट इस तरीके से बिहेव करें

play16:20

ठीक है तो यह जाओ और बनाओ और इसके बाद हम

play16:23

बात कर रहे होंगे फ्लोट प्रॉपर्टी के बारे

play16:25

में फ्लैट एंड क्लियर ये किस तरीके से कम

play16:27

करते हैं वो भी बहुत इंपॉर्टेंट होते हैं

play16:29

तो आप हो सकता है की इस बॉक्स को राइट

play16:31

साइड एलॉय ना कर पाऊं लेकिन फ्लैट

play16:33

प्रॉपर्टी की वजह से हम लोग इसको राइट

play16:34

साइड में एलन कर पाएंगे वो हम देखेंगे

play16:35

नेक्स्ट वीडियो के अंदर और साथ में आप देख

play16:37

रहे होंगे की ये किस तरीके से बनता है

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
CSS PositioningWeb LayoutUser ExperienceFixed PositionRelative PositionAbsolute PositionSticky PositionHTML StructureWeb DesignScrolling ElementsPosition Properties
¿Necesitas un resumen en inglés?