Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

sec ozin
1,297 Pointshow to put images horizontally in css
a {
text-decoration: none;
}
img {
width: 300px;
height: 300px;
}
body {
font-family: 'Open Sans', sans-serif;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
}
header {
float: left;
margin:0 0 10px 0;
padding: 5px 0 0 0;
}
#logo {
text-align: center;
margin: 0;
}
h1 {
font-family: 'Economica', sans-serif;
margin: 15px 0px;
font-size: 18em;
font-weight: normal;
line-height: 0.8em;
}
h2 {
font-family: 'Economica', sans-serif;
font-size: 1.70em;
margin: -5px 0 0;
padding: 15px 50px 30px 10px;
font-weight: normal;
}
nav {
font-family: 'Economica', sans-serif;
font-size: 2.00em;
margin-top: 80px;
}
nav ul {
list-style: none;
margin: 0 10px;
padding:0;
}
nav li {
display:inline-block;
}
nav a {
font-weight: 800;
padding: 15px 10px;
}
a {
color: white;
}
/*grey header*/
header {
background: #585858;
border-color: #yellow;
width: 1300px;
height: 450px;
}
h1, h2 {
color: #fff;
}
nav {
background: #585858;}
nav a, nav a:visited {
color: #BDBDBD;
}
nav a.selected, nav a:hover {
color:white;
}
footer {
font-size: 0.75em;
text-align: center;
clear: both;
padding-top: 50px;
color: #ccc;
}
.social-icon {
width: 20px;
height: 20px;
margin: 0 5px;
}
#gallery {
margin: 0;
padding: 0;
list-style; none;
}
#gallery li {
float: left;
width: 45%;
margin: 2.5%;
background-color: #fff;
color: #bdc3c7;
display: inline-block;
}
#gallery li a p {
margin: 0;
padding: 5%;
font-size: 0.75em;
color: #bdc3c7;
}
body {
background-color: #fff;
color: 999;
}
4 Answers

Fynn Lehnert
15,244 Pointsand how do you want to put your image horizontally? like across the screen? in this case use
selector {
background-image: url(../path/to/img.png);
background-size: cover;
}

Shawn Denham
Python Development Techdegree Student 17,801 PointsI see your code, but I am with Fynn Lehnert ... I am not sure what you are asking. if you just want your images to display horizontally.
Is this what you mean? http://codepen.io/Bluediv/pen/ZQJJKY

Fynn Lehnert
15,244 Pointsin this case add this to your css:
img {
display: inline-block;
}

sec ozin
1,297 PointsI want images to display horizontally.I did try same as on the link you send me(http://codepen.io/Bluediv/pen/ZQJJKY) but didn't work.Also i tried " img {display: inline-block;}" but didn't work.

Fynn Lehnert
15,244 Pointsplease put your code into codeshare.io and post the link here so we can help you better

sec ozin
1,297 Points
Fynn Lehnert
15,244 Pointsset your li's display: inline-block;

sec ozin
1,297 Pointsit didn't work :(