How To Create a Fullscreen Search Box

I’ll give that a try tomorrow and let you know.

ありがとう!

:slight_smile:

Well, I tested the code, but it does the opposite of what I wanted, making a really big icon in LG, then getting smaller and smaller at each smaller screen breakpoint. The iPhone breakpoint makes it super tiny! :slight_smile: But I do thank you for your time. I think I will just stick with 18px and keep the icon size consistent across all breakpoints.

Thanks, @Pealco!

@JDW sorry I miss understood, so there is the correct code:

After the .btn style after the last } add the following code:

/* JDW xs */
@media (max-width:544px) {
  .btn {
    font-size: 40px;
  }
}

/* JDW sm */
@media (max-width:768px) {
  .btn {
    font-size: 40px;
  }
}

/* JDW md */
@media (max-width:992px) {
  .btn {
    font-size: 40px;
  }
}

/* JDW lg */
@media (max-width:1200px) {
  .btn {
    /* Never get larger than this */
    font-size: 40px;
  }
}

Then in each viewport change the font size that you want…

1 Like

Wow! Thank you, @Pealco! You are the master of code! And because you are the master, and I bow to your genius, I am curious what you think about hiding Blocs when crossing breakpoints. I started another discussion about that last night, but so far I am at a dead end:

SUMMARY: I cannot get Bootstrap 4’s Display Property to work right for some reason. So I guess JavaScript/jQuery code is my only recourse. When I preview in Blocs and click on my 製品 navilink in LG, my complex dropdown displays. But when I click MD, I want that dropdown to be closed automatically – not hidden but closed. That way, when I click LG again, the dropdown should be hidden from view (closed). And since my menu dropdown is different for MD and smaller, I want the same thing to happen on that dropdown Bloc too. When I preview in MD and click the hamburger icon to display the dropdown menu, if I then click LG, that dropdown should auto-close, and when I return to MD, the dropdown should still be hidden (closed). Any thoughts on that would be greatly appreciated.

A THOUSAND THANKS FOR YOUR KIND HELP!

I just wanted to update this thread to say that I needed to modify the Z-index in the code written by @Pealco to prevent Carousel from overlapping it. Here’s the modified code:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
  font-family: Arial;
}

* {
  box-sizing: border-box;
}

/* Style buttons */
.btn {
  background-color: DodgerBlue; /* Blue background */
  border: none; /* Remove borders */
  color: white; /* White text */
  padding: 12px 16px; /* Some padding */
  font-size: 16px; /* Set a font size */
  cursor: pointer; /* Mouse pointer on hover */
}

/* Darker background on mouse-over */
.btn:hover {
  background-color: RoyalBlue;
}

.openBtn {
  background: #f1f1f1;
  border: none;
  padding: 10px 15px;
  font-size: 20px;
  cursor: pointer;
}

.openBtn:hover {
  background: #bbb;
}

.overlay {
  height: 100%;
  width: 100%;
  display: none;
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0, 0.9);
}

.overlay-content {
  position: relative;
  top: 46%;
  width: 80%;
  text-align: center;
  margin-top: 30px;
  margin: auto;
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
  cursor: pointer;
  color: white;
}

.overlay .closebtn:hover {
  color: #ccc;
}

.overlay input[type=text] {
  padding: 15px;
  font-size: 17px;
  border: none;
  float: left;
  width: 80%;
  background: white;
}

.overlay input[type=text]:hover {
  background: #f1f1f1;
}

.overlay button {
  float: left;
  width: 20%;
  padding: 15px;
  background: #ddd;
  font-size: 17px;
  border: none;
  cursor: pointer;
}

.overlay button:hover {
  background: #bbb;
}
</style>



<div id="myOverlay" class="overlay">
  <span class="closebtn" onclick="closeSearch()" title="Close Overlay">×</span>
  <div class="overlay-content">
    <form action="/action_page.php">
      <input type="text" placeholder="Search.." name="search">
      <button type="submit"><i class="fa fa-search"></i></button>
    </form>
  </div>
</div>

<button class="btn"><i class="fa fa-search" onclick="openSearch()"></i></button>

<script>
function openSearch() {
  document.getElementById("myOverlay").style.display = "block";
}

function closeSearch() {
  document.getElementById("myOverlay").style.display = "none";
}
</script>