Don't understand other answers


#1

I have the same problem:

I don't understand your explanation.

$(document).ready(function() {
$("div").css("height", "200");
$("div").css("width", "200");
$("div").css("border-radius", "10px");
});


Code working, but returning "Oops, make sure..." [8. Changing your style]
#2

@willbakerman

First

We get the document ready to execute the code inside the curly brackets

Second

We style to div tag.

Last but not least

We close the function.

Hope this quick explanation helped.


#3

Not really no. Was this an automated response?

I have that code in my JS page?


#4

@willbakerman

When I said styling something is a bit like the style attribute in HTML

<html_element style="property: value"></html_element>

But instead, we put it inside of JavaScript

$("html_element").css("property", "value")

#5

So I need to have an "_" involved?


#6

@willbakerman

No, this is only a demonstration, usually, no HTML element takes an underscore. In this example, instead of html_element, you should put div because this is the HTML element you want to modify.


#7

As mentioned earlier, this is the only time we see the width() and height() methods is in this course. These are known as convenience methods since they can be readily used in a dynamic, standalone manner.

We can both get and set with the methods.

var h = $('div;).height();    // get the height of a div
var w = $('div').width();     // get the width of a div

In a dynamic manner, we could say for instance make a jQuery object of the div. To make it unique we could give it an id or traverse the DOM tree to isolate it:

var $dynamic_div = $('div:first-child');
var h = $dynamic_div.height();
$dynamic_div.height(h+10);