First time on here so forgive me if I ask in the wrong way, or don't quite say things right. I have VERY recently begun to learn HTML5 and CSS , on an online course. Currently studying for MTA exam 98 375. Ive just go onto the section on flexbox, and am struggling. My tutor hasn't really been able to explain whats going wrong. The book gave me this to create a flexbox , and show it displaying horizontally. It will not do so for me but remains vertical :
<!DOCTYPE html>
<html>
<head>
<title>FLex Function Example</title>
<style>
div {
display: flexbox;
display: -ms-flexbox;
display: -moz-flexbox;
display: -o-flexbox;
display: -webkit-flexbox;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-o-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
height: 200px;
padding: 1em;
color: white;
outline: 2px solid silver;
}
div>div {
width: 75px;
width: -ms-flex(1 75px);
width: -moz-flex(1 75px);
width: -o-flex(1 75px);
width: -webkit-flex(1 75px);
margin: 1em;
height: 100px;
background-color: #b200ff;
font-family: sans-serif;
text-align: center;
line-height: 100px;
font-size:large;
}
</style>
</head>
<body>
<div>
<div>Service 1</div>
<div>Service 2</div>
<div>Service 3</div>
</div>
</body>
</html>
I am on a mac, using most recent Firefox, Opera and safari. Tutor did not seem to understand what the issue was, kept telling me i needed the prefixes (which I used!). The code is eaxctly as in book but result appears differently. Wierdly, after reading a lot online (most of which I didn't understand) I tried changing flexbox to flex (I think that was a suggestion somewhere) as this (the rest of coding stayed the same):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Flex function Example</title>
<style>
div {
display:flex;
display:-ms-flex;
display:-moz-flex;
display:-o-flex;
display:-webkit-flex;
flex-wrap:wrap;
-ms-flex-wrap:wrap;
-moz-flex-wrap:wrap;
-o-flex-wrap:wrap;
-webkit-flex-wrap:wrap;
- and now it looks like the book says it should. BUt - i have to pass an exam and create a portfolio and dont understand what is happening or why. Can anyone help me? Sorry its so long!