Alex T
Alex T

Reputation: 3754

right floated and left floated elements go out of container in semantic ui

As you can see in the fiddle here: https://jsfiddle.net/qar4n4ey/6/ The two buttons at the bottom are partially outside the container. It happened when i floated them both left and right. How to keep them inside the container?

HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>MYMDB</title>
        <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.css">
        <link rel="stylesheet" type="text/css" href="/stylesheets/app.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    </head>
    <body>

<div class="ui main center aligned text container segment">

    <div class="ui huge header">Search for a TV show</div>
    <form class="ui form" action="results" method="GET">
        <div class="ui search">
              <div class="ui icon input">
                <input class="prompt" type="text" placeholder="Tv shows..." name="search">
                <i class="search icon"></i>
              </div>
              <div class="results"></div>
        </div>


        <input id="greenbtn" class="ui green button" type="submit">
    </form>



    <a id="run" href="/run" class="ui left floated blue animated button" tabindex="0">
      <div class="visible content">Run python</div>
      <div class="hidden content">
          <i class="terminal icon"></i>
      </div>
     </a>

    <a id="show-data" href="/data" class='ui right floated disabled button'> See the table </a>

</div>

        </body>
</html>

And some css

#greenbtn {
  margin-top:10px;
}

Upvotes: 1

Views: 2622

Answers (3)

Alexander Tyapkov
Alexander Tyapkov

Reputation: 5017

All the given answers don't use functionality of Semantic UI. If you want to do it in Semantic UI way then you can use clearing serment:

<div class="ui main center aligned text container clearing segment">
</div>

Upvotes: 6

pavel
pavel

Reputation: 27082

Add clear: both after floated elements, or overflow: hidden to parent box.

.main.container {overflow: hidden}

https://jsfiddle.net/qar4n4ey/12/

Upvotes: 1

Kushtrim
Kushtrim

Reputation: 1939

Use float: left for the container also

 .ui.container{
      float: left; // you could also use display: inline-block;
      width: 100% !important;
    }

Upvotes: 1

Related Questions