Hey ninjas, in this CSS Positioning tutorial, I'll introduce you to floating elements. CSS floats are one of the most powerful and widely used CSS positioning properties, but can be a little tricky to get your head around at first!
SUBSCRIBE TO CHANNEL - https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to - https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter - @TheNetNinja - https://twitter.com/thenetninjauk
Heyy Ninja, its been 4 years now since you released this video and a lot of things have changed I think. Just having a query, when u float all the box to left, they are still inside the white area, but in my case, white area's height becomes 20px due to padding of 10px each side, and box height is 100px, this makes these box out of the white area, why is it happening??
That would be correct.
If an element has 'position: absolute' then the positioning values of 'top', 'left' etc position it relative to the nearest ancestor which has a position property set. If there's no such ancestor, then the element is being positioned relative to the html element (or window).
Great Explanation, thanks!!!
In case of box when u add a float : left style to red box its overlapping green box which is in document flow, But in image case why image not overlapping paragraph textwhen we apply float : right to it?
Ok, I know this is for the seasoned devs but it's important to note that float nowadays is the back compat response to supporting IE - people REALLY should be using/taught display: inline-block as it clears itself (is extremely widespread in terms of support) and adheres to the workflow! Float was never designed for layouts but was the solution when we all took the leap into tableless design looking for solid support.
For start sorry for my bad english. I didn't uderstand while in the first example you have shown us about an image floating next to a text, the text wasn't hidden behind the image, whereas; in the second example, the green box was hidden behind red box. I think the green box should stay next to the red box, but it was hidden behind. Im so confused.Maybe it is a rerlationship between <p> tags and <img> tags. Please enlighten me! :)
bro that's how floats work!! the elements moves to the left and gets floated ie. gets above through some height and due to the free space available ,the elements below it moves upwards in order to fill that vacant space,.....................https://youtu.be/xara4Z1b18I visit this to understand it in detail.
Yes mate, amazing. I've been teaching myself for 2 months, watching videos, reading books, and even watched a bunch of Treehouse. No one has done this yet. Also, the only thing I've struggles with is css positioning. No one can explain it well. I think your videos may do the trick. Thanks!
Hey, class="red box" means the element has 2 classes - one of them is 'red' and the other is 'box'. It does not mean 1 single class of 'red box'. It would only be a single class if there are no spaces between the words. For example, class="red-box" or class="redbox". Hope this helps :)
Oh yeah I forgot that offsetting, Thanks man! I already watched that playlist. but did not strike until now.
btw, I tried Brackets. Live integration doesn't work sometimes, So I'm using Dreamweaver. and it Rocks.
FYI, THIS Playlist is Not listed in your Channel Playlists Page along with other CSS PlayList. Add It. I particularly searched for this and then came here.
Subscribed. I just started learning HTML & CSS. You will be great companion from now on.
Hey, you could use position absolute, to absolutely position an element over another - this is how Google does it. For example:
<input type="text" />
<div id="your-button">button img or text</div>
You could give the container a position of relative. Span the input field 100% in width & position the 'your-button' div absolutely over the right side of the input field. I cover both relative and absolute position later in this playlist!
Hey Felipe, There are little tricks using position:relative and the transformY property to achieve the text directly in the centre..
However, I would recommend using flexbox to centre the content, its much easier and tends to be the way to do it these days..
Apply "display: flex" to the parent div
and "margin: auto" to the element itself should result in a perfectly centred element.
p.s im also just learning so there might be other ways to achieve without using flexbox..
the class names used are "blue box", "red box" and "green box" , when he used .box then the properties mentioned got applied to all three div's and when he used .blue, .red and .green then the properties got applied to the div whose class name consisted of red green or blue. This is a way of selecting classes.
Hello from russia. I understand what you say, but i only see and after i understand what you do. :D haha thanks man:) you must know, what in Russia not have good tutorial... really. you very good, befory this video you packing material ( code ) i see this you work. it really good.
Hi! Thanks for this wideo :) I have a question: WHY in 05:07 the blue box is at the same level as red box?
Why the blue box after adding "float: right;" didnt come higher than red box?
In "div" blue box its higher that "div" with red box ... Im confused. :(
Its not a normal website flow as on the example with image in 02:43?
how do you float one box in the dead middle? even if it is the only box. Also the div container, does it automatically adjust it's size if the person resize the webpage it was on or do the letters in the box or box go all crazy?
you are the best tutor ive come accross on youtube. i have request can you make a tutorial about learning code? what i mean is whenever i learn new code i forgot it after 5 minutes or so. can u make a tutorial about learning and not forget
Download the appropriate system image for your device below, then unzip it to a safe directory.
Connect your device to your computer over USB.
Start the device in fastboot mode with one of the following methods:
Using the adb tool: With the device powered on, execute:
Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device.
If necessary, unlock the devices bootloader using one of the following methods:
If you are updating a Nexus or Pixel device that is manufactured in 2015 or later (for example, a Nexus 5X, Nexus 6P, Pixel, Pixel XL, Pixel 2 or Pixel 2 XL device), run this command:
For Pixel 2: To flash the bootloader, Pixel 2s boot loader must be updated to at least Oreo MR1s version first. This may be done by applying an over-the-air (OTA) update, or sideloading a full OTA with the instructions on that page.
For Pixel 2 XL only with loader version prior to TMZ20a: the critical partitions may also need to be unlocked before flashing. The unlock can be performed with this command, and should NOT be done on other devices:
If you are updating an older device, run this command:
The target device will show you a confirmation screen. (This erases all data on the target device.)
See Unlocking the bootloader for more detailed instructions.
Open a terminal and navigate to the unzipped system image directory.