- Home
-
HTML
HTML Introduction HTML Tags HTML Elements HTML Attributes HTML Heading HTML Paragraph HTML Formatting HTML Quotations HTML Comments HTML Styles HTML Color HTML CSS HTML Images HTML Favicon HTML Links HTML DIV HTML Tables HTML Table Size HTML Table Head Table Padding & Spacing Table colspan rowspsn HTML Table Styling HTML Colgroup HTML List HTML Block & Inline HTML Classes HTML Id HTML Iframes HTML Head HTML Layout HTML Semantic Elements HTML Style Guide HTML Forms HTML Form Attribute HTML Form Element HTML input type HTML Computer code HTML Entity HTML Symbol HTML Emojis HTML Charset HTML Input Form Attribute HTML URL Encoding
-
CSS
CSS Introduction CSS Syntax CSS Selector How To Add CSS CSS Comments CSS Colors CSS Background color CSS background-image CSS Borders CSS Margins CSS Height, Width and Max-width CSS Box Model CSS Outline CSS Text CSS Fonts CSS Icon CSS Links CSS Tables CSS Display CSS Maximum Width CSS Position z-index Property
- JavaScript
-
JQuery
What is jQuery? Benefits of using jQuery Include jQuery Selectors. Methods. The $ symbol and shorthand. Selecting elements Getting and setting content Adding and removing elements Modifying CSS and classes Binding and Unbinding events Common events: click, hover, focus, blur, etc Event delegation Using .on() for dynamic content Showing and hiding elements Fading elements in and out Sliding elements up and down .animate() Understanding AJAX .ajax() .load(), .get(), .post() Handling responses and errors. Parent Chlid Siblings Filtering Elements Using find Selecting form elements Getting form values Setting form values Form validation Handling form submissions jQuery plugins Sliders plugins $.each() $.trim() $.extend() Data attributes Debugging jQuery code
-
Bootstrap 4
What is Bootstrap Benefits of using Setting up Container Row and Column Grid Classes Breakpoints Offsetting Columns Column Ordering Basic Typography Text Alignment Text colors Backgrounds Display Font Size Utilities Buttons Navs and Navbar Forms Cards Alerts Badges Progress Bars Margin Padding Sizing Flexbox Dropdowns Modals Tooltips Popovers Collapse Carousel Images Tables Jumbotron Media Object
- Git
-
PHP
PHP Introduction PHP Installation PHP Syntax PHP Comments PHP Variable PHP Echo PHP Data Types PHP Strings PHP Constant PHP Maths PHP Number PHP Operators PHP if else & if else if PHP Switch PHP Loops PHP Functions PHP Array PHP OOps PHP Class & Object PHP Constructor PHP Destructor PHP Access Modfiers PHP Inheritance PHP Final Keyword PHP Class Constant PHP Abstract Class PHP Superglobals PHP Regular Expression PHP Interfaces PHP Static Method PHP Static Properties PHP Namespace PHP Iterable PHP Form Introduction PHP Form Validation PHP Complete Form PHP Date and Time PHP Include Files PHP - Files & I/O File Upload PHP Cookies PHP SESSION PHP Filters PHP Callback Functions PHP JSON PHP AND Exceptions PHP Connect database
-
MY SQL
SQL Introduction Syntax Select statement Select Distinct WHERE Clause Order By SQL AND Operator SQL OR Operator SQL NOT Operator SQL LIKE SQL IN SQL BETWEEN SQL INSERT INTO SQL NULL Values SQL UPDATE SQL DELETE SQL TOP, LIMIT, FETCH FIRST or ROWNUM Clause SQL MIN() and MAX() Functions SQL COUNT() Function SQL SUM() SQL AVG() SQL Aliases SQL JOIN SQL INNER JOIN SQL LEFT JOIN SQL RIGHT JOIN SQL FULL OUTER JOIN SQL Self Join SQL UNION SQL GROUP BY SQL HAVING SQL EXISTS SQL ANY and ALL SQL SELECT INTO SQL INSERT INTO SELECT SQL CASE SQL NULL Functions SQL Stored Procedures SQL Comments SQL Operators SQL CREATE DATABASE SQL DROP DATABASE SQL BACKUP DATABASE SQL CREATE TABLE SQL DROP TABLE SQL ALTER TABLE SQL Constraints SQL NOT NULL SQL UNIQUE Constraint SQL PRIMARY KEY SQL FOREIGN KEY SQL CHECK Constraint SQL CREATE INDEX SQL AUTO INCREMENT SQL Dates SQL Views SQL Injection SQL Hosting SQL Data Types
CSS position Property
The CSS position
property is used to control the positioning of an element within its containing block. It can take on several values, each of which affects the element's positioning differently. Here’s a rundown of the most common values:
1. static
- Default Value: The default positioning method for all elements. Elements are positioned according to the normal flow of the document.
- Behavior: The
top
,right
,bottom
, andleft
properties have no effect.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Static Position</title>
<style>
.box {
position: static;
background-color: lightblue;
width: 200px;
height: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">Static Position</div>
</body>
</html>
2. relative
- Behavior: The element is positioned relative to its normal position. You can use the
top
,right
,bottom
, andleft
properties to adjust its position from where it would normally be. - Effect: This allows you to shift the element without changing the layout around it.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Relative Position</title>
<style>
.box {
position: relative;
top: 20px;
left: 30px;
background-color: lightgreen;
width: 200px;
height: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">Relative Position</div>
</body>
</html>
3. absolute
- Behavior: The element is positioned relative to its nearest positioned ancestor (i.e., an ancestor element with a position other than
static
). If no such ancestor exists, it is positioned relative to the initial containing block (usually the viewport). - Effect: The element is removed from the normal document flow, and the
top
,right
,bottom
, andleft
properties specify its position.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Absolute Position</title>
<style>
.container {
position: relative;
height: 200px;
background-color: lightgray;
border: 1px solid black;
}
.box {
position: absolute;
top: 10px;
right: 20px;
background-color: lightcoral;
width: 100px;
height: 50px;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="container">
<div class="box">Absolute Position</div>
</div>
</body>
</html>
4. fixed
- Behavior: The element is positioned relative to the viewport, and it stays in the same place even when the page is scrolled.
- Effect: The element is removed from the normal document flow, and the
top
,right
,bottom
, andleft
properties specify its position within the viewport.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fixed Position</title>
<style>
.box {
position: fixed;
bottom: 10px;
right: 10px;
background-color: lightgoldenrodyellow;
width: 150px;
height: 75px;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">Fixed Position</div>
<p>Scroll down to see the fixed position.</p>
<div style="height: 2000px;"></div>
</body>
</html>
5. sticky
- Behavior: The element is treated as relative until it crosses a specified threshold (using
top
,right
,bottom
, orleft
), at which point it is treated as fixed. - Effect: The element sticks to the specified position when the scroll reaches that threshold, but scrolls away with the rest of the content when you scroll past it.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sticky Position</title>
<style>
.box {
position: sticky;
top: 0;
background-color: lightpink;
width: 100%;
height: 50px;
border: 1px solid black;
z-index: 1000;
}
.content {
height: 2000px;
background-color: lightblue;
}
</style>
</head>
<body>
<div class="box">Sticky Position</div>
<div class="content"></div>
</body>
</html>
Each value of the position
property serves different use cases, so choosing the right one depends on the layout needs and behavior you want to achieve for your elements.
At Online Learner, we're on a mission to ignite a passion for learning and empower individuals to reach their full potential. Founded by a team of dedicated educators and industry experts, our platform is designed to provide accessible and engaging educational resources for learners of all ages and backgrounds.
Copyright 2023-2024 © All rights reserved.