csis390/
.csis390
folder for storing your lab work, i.e.,
csis390/labs
.lab1, lab2, ..., lab3
.Download all the HTML and CSS files in the
lab2 folder
to your own lab2
folder, i.e., csis390/labs/lab2
selectors.css
using Notepad++.
selector.html
in Chrome and refresh the
web page each time you save your CSS changes.
selectors.css
to override the existing CSSheader
so it aligns left instead of centerh1
and nav
inside the header
display as inline-block
ul
inside the header
have a margin of zero all around so it is as compact as possibleh1
inside the header
have left margin of 30px and zero on the other three sides.side_content
elements float left and clear left, and set the left margin to zero.#main_content
element float right footer
clear both, so it will always be
below the elements above it that are floating left or right.#main_content
is positioned below the side menu.
This is because the #main_content
element
is defined after the two .side_content
elements.
When we "clear" the .side_content
section,
the #main_content
div moves down even though
there is space above it. When using float, content defined below an
element cannot not be displayed above that element.
.side_content
section
after the #main_content
div in the HTML document.
selectors.html
and move the side content section
so that it is defined below
the #main_content
#main_content
.
But the .side_content
section is less important than the #main_content
,
so it should be defined afterwards in the HTML document.
@media
code as an example. Copy and paste it
to create a new media query that does the following:
min-width
is 1000px, then... #container
width 950px.side_content
float left and set clear to none#main_content
float leftsection.side_content
left margin of 30px, so
it is not close to the #main_content
. Note
that you do not want to add left margin to all
.side_content
elements just the side content section, i.e., section.side_content
.
Note that the selector does not have a space.section
and footer
touch each other even
though the footer
has top margin. This is because the #main_content
floats left and floating elements can occupy the margin of block elements
such as headers and footers.
#main_content
.
Block elements will "respect" the margin of floating elements.
p
tag.
Hint: the selector p .special
has a space in it,
so it is really specifying two elements, a p
and an element
with the class name special
. If you leave out the space, i.e.
p.special
, you are specifying one element, i.e.,
a paragraph with class name special
.
section
element.
Verify that your CSS code, i.e., selectors.css
validates at:
jigsaw.w3.org/css-validator
Then, show your instructor your completed valid document.
Note that the website should have a responsive three column design.
When the browser is 1000px wide or greater, there should be three columns.
When the browser is less than 800px wide, there should be one column.
Otherwise, there should be two columns.
form_basic.html
in Notepad++ and alter it so that it looks like this:pony_type
, specifically with
the values and labels "Pegasus" and "Alicorn"
id
's that match
the for
attribute in the corresponding labels
skill[]
. Use
values and labels of your choosing. For instance,
ponies could have ninja skills such as "Nunchaka" and "Kenjutsu"
id
's that match
the for
attribute in the corresponding labels
select
tag (drop-down menu)
in zyBook Chapter 2.3 and look at this example
select
tag with both a name
and id
of "pony_color"
select
tag, add at least 5 color options.
Be sure to specify both the value and the visible content inside the option
tag.
select
tag should have both an id
and name
attribute, but the option
tags should only have value
attributes,
i.e., value = "red"
input type="date"
in zyBook Chapter 2.4.
input
tag with a name
and id
of "pony_birthday"
style
tag to decorate the div
and
label
tags.
div
tag should
have a 1px solid gray border and both padding and margin to add better spacing.
label
tags bold, but only the first label tag
in each div
tag. Read about the
nth-child selector
if you forgot how you can select only the first child
name
and an id
?name
attribute
The name
attribute is very important because the HTTP protocol
uses it to identify submitted values. When a form is submitted,
an HTTP request is made and all the values that are entered or selected
in the form are sent in an associative array. The names are used as the array indices
so that server-side scripts can "get" the submitted values by name. If
your names are not 100% correct, server-side scripts will fail.
The convention for names is to use all lowercase letters and to never use spaces.
Use underscores _ instead of spaces.
id
attribute
The id
attribute is also important because it is used
by JavaScript to uniquely identify elements. It is common to
use JavaScript to make sure a form is correctly filled out (called "form validation")
before submitting the value in an HTTP request.
The id
of each form element can also be "connected" to the corresponding
label
tag. JavaScript can be used to highlight the label
for elements that are blank or not filled out correctly. We will learn how
to do this when we study JavaScript in two weeks.
Verify that your HTML code, i.e., basic_form.html
validates at:
html5.validator.nu
Then, try submitting your form with real values. If you named
all the element according to the instructions, a server-side script called
insert_pony.php
will display the form values as
an associative array, then each individual value will be display and finally
the script could insert the data into a database but this feature
has been disabled since this script is not yet secured.
Create a zip file of your lab2
folder called lab2.zip
and submit the file in Blackboard. The zip file should contain three files:
selectors.html
, selectors.css
and basic_form.html
.
In the comment area of Blackboard put your partner's name.
The deliverable must be submitted in Blackboard by midnight on the day before your next scheduled lab meeting. If you wish to work alone, you can submit the deliverable yourself. However, you are encouraged to work with your partner and you can submit together. When submitting as a lab pair, be sure to include your partner's name in the comment area when you submit via Blackboard.
Outside of lab, you are only permitted to work with your lab partner. Do not share your work with any other student.