left css code example
Example 1: what are the types of positioning in css
The types of positioning in CSS are-
1)static: this is the default value.
2)sticky: the element is positioned based on the user's scroll position.
3)fixed: the element is positioned related to the browser window.
4)relative: the element is positioned relative to its normal position.
5)absolute: the element is positioned absolutely to its first positioned parent.
Example 2: how to add a left margin in css
<html>
<head>
</head>
<body>
<p style = "margin-left: 15px; border:1px solid black;">
This is a paragraph with a specified left margin
</p>
<p style = "margin-left: 5%; border:1px solid black;">
This is another paragraph with a specified top margin in percent
</p>
</body>
</html>
Example 3: padding left
.yourClass {
padding-left: 50px; // or
padding-left: 1%; // to scale it in relation to its parent
}
Example 4: html position div
<!DOCKTYPE html> <!-- Start of coding page -->
<html> <!-- Start of html coding -->
<head> <!-- Start of head -->
<title>TITLE<title> <!-- Title -->
<script>
//JavaScript
</script>
<style>
</style>
</head> <!-- End of head -->
<body> <!-- Start of body -->
<div id='mydiv' style = "position:relative; left:0px; top:100px;">
Hello!
<!-- Use that style tag to positions things, have a play around with it! -->
</div>
</body> <!-- End of body -->
<html> <!-- End of html coding -->
<!-- Add this line of code next to your id:
style = "position:relative; left:0px; top:100px;"
too let you position divs where you want them, you can even position
them ontop of other divs! -->
Example 5: css left
.right {
position: fixed;
left: ;
}