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! While you're at it, check out some resources Treehouse students have shared here.
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
Adam Ridgley
12,255 PointsCSS Problem
Hello everyone,
I'm trying to make a form which displays the elements in the form inline block but I'm having trouble actually getting it to work correctly.
HTML
<div id="search-panel">
<form method="get" action="<?php echo BASE_URL; ?>categories">
<input type="text" name="name" placeholder="Search name or keyword">
<select name="category">
<option value="all">Select category</option>
<?php foreach($data['artiste_index'] as $category) { ?>
<option value="<?php echo $category['name']; ?>"><?php echo $category['name']; ?></option>
<?php } ?>
</select>
<select name="gender">
<option value="">Select</option>
<option value="1">Male</option>
<option value="2">Female</option>
<option value="3">Group</option>
</select>
<input type="submit" value="Search">
</form>
CSS
form input[type=text] {
display:inline-block;
}
form select {
display:inline-block;
}
The select elements display inline block, but the text input box doesn't unless you remove the first select box from the HTML, then it will work correctly but I really don't know why that happens.
Any advice?
Thanks, Adam
1 Answer
Russell Sawyer
Front End Web Development Techdegree Student 15,705 PointsThe way I search for errors in my CSS is to open the dev tools. You can turn CSS attributes off and add new ones right in the dev tools, which is temporary. When you find the error you can then make it permanent in the CSS.
john larson
16,594 Pointsjohn larson
16,594 PointsWhen I run your code, everything is in one line as I would expect. Do you have the select box in question set to block somewhere else in the css?