Nau
Nau

Reputation: 479

Avoid line breaks in a div

How can I avoid line breaks in a div when I use a php funcion. My code is HTML is

<div class="toolbar"> 
  <div style="float:left; "> 
    Profile <?php get_search_form(); ?> 
  </div>
</div>

and my code in css is

.toolbar {
  background: #F2F2D7;
  width: inherit;
  font-family: "Palatino";
  padding-top: 5px;
  padding-bottom: 5px;
  position: fixed;
  top: 0;
  box-shadow: 0px 4px 9px 2px #888888;
  z-index:2;
  white-space: nowrap;
}

with that I obtain something like:

<p> Profile </p> <p> Buscador </p>
<p> and what I want is </p>

Profile Buscador

Upvotes: 0

Views: 127

Answers (3)

Nau
Nau

Reputation: 479

Yes, as user197092 said, this is a php problem, and if it is a predifined function it could be hard to adjust the result to not include embbed div tags. I solved it using flex, my code is:

<div id="toolbar"> 

            <div id="toolbar1"> 
                Profile
            </div>

            <div id="toolbar2"> 
                <?php echo get_search_form(); ?>
            </div>

        </div>

and for CSS

#toolbar {
display: flex;}

#toolbar1 {
flex: 1;}

#toolbar2 {
flex: 2;
margin-left: 10px; }

this worked for me

Upvotes: 0

Adam Zuckerman
Adam Zuckerman

Reputation: 1641

It depends on what get_search_form() is returning. If it is returning a string, then you may need to look at the applied styling for the containing div.

If it is returning an an HTML fragment (e.g., <span>your result</span>), you may need to adjust the results to not include any embbed div tags.

Upvotes: 2

user197092
user197092

Reputation: 1

It sounds like your looking for the <span> tag. Its used to divide segments of HTML for styling.

Upvotes: 0

Related Questions