HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<section>
<div class="main-search">
<h1>Найдите квартиру мечты</h1>
<div class="main-search-line">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#home">Купить</a></li>
<li><a data-toggle="tab" href="#menu1">Снять</a></li>
<li><a href="example.com">Ипотека</a></li>
</ul>
<div class="tab-content">
<!--Первый таб Купить-->
<div id="home" class="tab-pane fade in active">
<div class="search-line" id="search-line-1">
<!--Выбор типа недвижимости-->
<div class="search-line-item select-types">
<select class="select-type select-type-1">
<optgroup label="Квартиры и комнаты">
<option value="квартира-вторичка" selected>Вторичное жилье</option>
<option value="квартира-новостройка">Квартира в новостройке</option>
<option value="комната">Комната</option>
</optgroup>
<optgroup label="Дома и участки">
<option value="дом">Дом</option>
<option value="коттедж">Коттедж</option>
<option value="участок">Участок</option>
</optgroup>
<optgroup label="Коммерческая">
<option value="office">Офис</option>
<option value="retail">Магазин</option>
<option value="warehouse">Склад</option>
<option value="business">Готовый бизнес</option>
<option value="free-purpose">Свободного назначения</option>
</optgroup>
</select>
</div>
<!--Комнатность-->
<div class="search-line-item room-checkbox room-checkbox-1">
<label><input type="radio" value="1" name="rooms-number">1</label>
<label><input type="radio" value="2" name="rooms-number">2</label>
<label><input type="radio" value="3" name="rooms-number">3</label>
<label><input type="radio" value="4" name="rooms-number">4</label>
<span> - ком. </span>
</div>
<!--Стоимость-->
<div class="search-line-item prices-input">
<input type="number" class="money price-input" id="price-from-input" name="price-from" placeholder="От">
<input type="number" class="money price-input" id="price-to-input" name="price-to" placeholder="До">
<span>₽</span>
</div>
<!--Поиск по адресу-->
<div class="search-line-item search-by-keyword search-by-keyword-1">
<input name="keyword" type="text" id="input-keyword-1" class="houzez_search_ajax search-line-addres" value="" placeholder="Поиск по адресу">
<div id="auto_complete_ajax" class="auto-complete"></div>
</div>
</div>
</div>
<!--Второй таб Снять-->
<div id="menu1" class="tab-pane fade">
<div class="search-line" id="search-line-2">
<!--Выбор типа недвижимости-->
<div class="search-line-item select-types">
<select class="select-type select-type-2">
<optgroup label="Квартиры и комнаты">
<option value="квартира-вторичка" selected>Квартира</option>
<option value="комната">Комната</option>
</optgroup>
<optgroup label="Дома">
<option value="дом">Дом</option>
<option value="коттедж">Коттедж</option>
</optgroup>
<optgroup label="Для бизнеса">
<option value="office">Офис</option>
<option value="retail">Магазин</option>
<option value="warehouse">Склад</option>
<option value="business">Готовый бизнес</option>
<option value="free-purpose">Свободного назначения</option>
</optgroup>
</select>
</div>
<!--Комнатность-->
<div class="search-line-item room-checkbox room-checkbox-2">
<label><input type="checkbox" value="1" name="rooms-number">1</label>
<label><input type="checkbox" value="2" name="rooms-number">2</label>
<label><input type="checkbox" value="3" name="rooms-number">3</label>
<label><input type="checkbox" value="4" name="rooms-number">4</label>
<span> - ком. </span>
</div>
<!--Стоимость-->
<div class="search-line-item prices-input">
<input type="number" class="money price-input" id="price-input-to-2" name="price-from" placeholder="От">
<input type="number" class="money price-input" id="price-input-from-2" name="price-to" placeholder="До">
<span>₽</span>
</div>
<!--Поиск по адресу-->
<div class="search-line-item search-by-keyword search-by-keyword-1">
<input name="keyword" type="text" id="input-keyword-2" class="houzez_search_ajax search-line-addres" value="" placeholder="Поиск по адресу">
<div id="auto_complete_ajax" class="auto-complete"></div>
</div>
</div>
</div>
</div>
</div>
<!--Кнопка поиска-->
<div class="search-button">
<button class="search-btn" id="go-to-search">Поиск</button>
</div>
</div>
</section>
:active, :hover, :focus {
outline: 0 !important;
outline-offset: 0 !important;
}
.main-search {
background: #f7eecb;
background-size:cover;
padding:100px 300px;
}
.main-search h1 {
font-size:50px;
text-align: center;
color:#333;
}
.main-search .nav {
margin-bottom:1px;
}
.main-search .nav-tabs {
border-bottom:0 !important;
}
.main-search .nav-tabs>li {
background:rgba(0,0,0,0.4);
border-top-left-radius:5px;
border-top-right-radius:5px;
}
.main-search .nav-tabs>li.active>a {
color: #333;
}
.main-search .nav-tabs>li>a {
color:#fefefe;
}
.main-search .nav-tabs>li>a:hover {
color:#333;
}
.search-line {
display:flex;
background: #fff;
box-shadow: 0 8px 16px rgba(0,0,0,0.2);
border-radius:4px;
border-top-left-radius: 0;
}
.search-line-item {
padding:15px;
}
.search-line-item.select-types {
width:20%;
}
.search-line-item .select-type {
background: #fff;
border:none !important;
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
}
.room-checkbox {
width:26%;
}
.room-checkbox label {
border:1px solid #ccc;
border-radius: 4px;
padding:4px 12px;
cursor: pointer;
}
.room-checkbox label:hover {
border-color:#333;
}
.room-checkbox label.active-label {
background: #8dddff;
color: #0073a5;
border-color: #a9e5ff;
}
.room-checkbox input {
display:none;
}
.room-checkbox-active {
}
.search-line-item.prices-input {
width:30%;
}
.search-line-item .price-input {
border:none;
padding:5px 12px;
width:46%;
}
.search-line-item input[name="price-from"] {
border-right:1px solid #ccc;
}
.search-line-addres {
border:none !important;
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
width:100%;
}
.search-line-item.search-by-keyword-1 {
width:30%;
}
.search-line-item.search-by-keyword-2 {
width:54%;
}
.search-button {
text-align: right;
}
.search-button .search-btn {
margin-top: 10px;
background: #00b3ff;
border: none;
border-radius: 4px;
color: #fefefefe;
padding: 10px 40px;
}
.select-types,.room-checkbox,.prices-input {
border-right:1px solid #f2f2f2;
}
@media screen and (max-width:430px) {
.main-search h1 {
font-size:30px;
}
.main-search {
padding:15px;
}
.search-line {
display:block;
}
.search-line-item {
width:100%;
}
.select-types, .room-checkbox, .prices-input {
border-bottom:1px solid #f2f2f2;
border-right:none;
}
.search-line-item.select-types {
width:100%;
}
.search-line-item.prices-input {
width:100%;
}
.search-line-item.search-by-keyword-1, .search-line-item.search-by-keyword-2 {
width:100%;
}
}
$(document).ready(function() {
//Нажатие на кнопки выбора комнатности
$('.room-checkbox label').on('click',function(){
$('.room-checkbox label').removeClass('active-label');
$(this).addClass('active-label');
});
//Убираем выбор комнатности у таба Купить
$('.select-type-1').on('change', function() {
if($('.select-type-1 option').filter(':selected').val() == "квартира-новостройка" || $('.select-type-1 option').filter(':selected').val() == "квартира-вторичка") {
$('.room-checkbox-1').css('display','block');
$('.search-by-keyword').addClass('search-by-keyword-1').removeClass('search-by-keyword-2');
}
else {
$('.room-checkbox-1').css('display','none');
$('.search-by-keyword').addClass('search-by-keyword-2').removeClass('search-by-keyword-1');
}
});
//Убираем выбор комнатности у таба Снять
$('.select-type-2').on('change', function() {
if($('.select-type-2 option').filter(':selected').val() == "квартира-новостройка" || $('.select-type-2 option').filter(':selected').val() == "квартира-вторичка") {
$('.room-checkbox-2').css('display','block');
$('.search-by-keyword').addClass('search-by-keyword-1').removeClass('search-by-keyword-2');
}
else {
$('.room-checkbox-2').css('display','none');
$('.search-by-keyword').addClass('search-by-keyword-2').removeClass('search-by-keyword-1');
}
});
//Обработка и переход к поиску
$('#go-to-search').on('click', function() {
var activeLi = $('.main-search-line ul li.active a').text();
if(activeLi == "Купить") {
var selectedType = $('.select-type option').filter(':selected').val();
var roomsNumber = $('.room-checkbox-1 label input').filter(':checked').val();
if(roomsNumber == null) {
roomsNumber = "";
}
var priceFrom = $('#price-from-input').val();
var priceTo = $('#price-to-input').val();
var keyword = $('#input-keyword-1').val();
keyword.replace(" ", "+");
var url = "yourwebsute.com?seach.php&type=" + selectedType + "&min-price=" + priceFrom + "&max-price=" + priceTo + "&bedrooms=" + roomsNumber + "&keyword=" + keyword;
$(location).attr('href',url);
}
else {
var selectedType2 = $('.select-type-2 option').filter(':selected').val();
var roomsNumber2 = $('.room-checkbox-2 label input').filter(':checked').val();
if(roomsNumber2 == null) {
roomsNumber2 = "";
}
var priceFrom2 = $('#price-input-to-2').val();
var priceTo2 = $('#price-input-from-2').val();
var keyword2 = $('#input-keyword-2').val();
keyword2.replace(" ", "+");
var url2 = "yourwebsute.com?seach.phptype=" + selectedType2 + "&bedrooms=" + roomsNumber2 + "&min-price=" + priceFrom2 + "&max-price=" + priceTo2 + "&keyword=" + keyword2;
$(location).attr('href',url2);
}
});
});
Also see: Tab Triggers