Skip to main content

Search Form Cho Blogger

Có lẽ lâu lắm rồi em không viết bài nhỉ, Chắc khoảng 1 tuần rồi. Chả là do việc "dùi mài kinh sử" nó rối tung cả lên, nên đành ngậm ngùi gác blog sang một bên để mà văn ôn võ luyện. Được lúc sáng nay rảnh nên tranh thủ post bài về Search Form cho Blogger luôn. Cái form này em thấy trên mấy WP blog khá đẹp, nên dùng view-source đại pháp đem về dùng :D.

Các bước tiến hành như sau:
  •  Vào Mẫu >> Chỉnh sửa HTML
  • Chèn đoạn code sau vào trước thẻ ]]></b:skin>
.form-wrapper {
 width: auto;
 padding: 8px;
 margin: 100px auto;
 overflow: hidden;
 border-width: 1px;
 border-style: solid;
 border-color: #dedede #bababa #aaa #bababa;
 border-radius: 3px;      
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
}

.form-wrapper #search {
 width: auto;
 height: 20px;
 padding: 10px 5px;
 float: left;    
 font: bold 16px 'lucida sans', 'trebuchet MS', 'Tahoma';
 border: 1px solid #ccc;
 -moz-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
 -webkit-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
 box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 border-radius: 3px;      
}

.form-wrapper #search:focus {
 outline: 0; 
 border-color: #aaa;
 -moz-box-shadow: 0 1px 1px #bbb inset;
 -webkit-box-shadow: 0 1px 1px #bbb inset;
 box-shadow: 0 1px 1px #bbb inset;  
}

.form-wrapper #search::-webkit-input-placeholder {
   color: #999;
   font-weight: normal;
}

.form-wrapper #search:-moz-placeholder {
 color: #999;
 font-weight: normal;
}

.form-wrapper #search:-ms-input-placeholder {
        color: #999;
        font-weight: normal;
} 

.form-wrapper #submit {
 float: right;    
 border: 1px solid #00748f;
 height: 42px;
 width: 35px;
 padding: 0;
 cursor: pointer;
 font: bold 13px Arial, Helvetica;
 color: #fafafa;
 text-transform: uppercase;    
 background-color: #0483a0;
 background-image: -webkit-gradient(linear, left top, left bottom, from(#31b2c3), to(#0483a0));
 background-image: -webkit-linear-gradient(top, #31b2c3, #0483a0);
 background-image: -moz-linear-gradient(top, #31b2c3, #0483a0);
 background-image: -ms-linear-gradient(top, #31b2c3, #0483a0);
 background-image: -o-linear-gradient(top, #31b2c3, #0483a0);
 background-image: linear-gradient(top, #31b2c3, #0483a0);
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 border-radius: 3px;      
 text-shadow: 0 1px 0 rgba(0, 0 ,0, .3);
 -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
 -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
 box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
}
  
.form-wrapper #submit:hover,
.form-wrapper #submit:focus {  
 background-color: #31b2c3;
 background-image: -webkit-gradient(linear, left top, left bottom, from(#0483a0), to(#31b2c3));
 background-image: -webkit-linear-gradient(top, #0483a0, #31b2c3);
 background-image: -moz-linear-gradient(top, #0483a0, #31b2c3);
 background-image: -ms-linear-gradient(top, #0483a0, #31b2c3);
 background-image: -o-linear-gradient(top, #0483a0, #31b2c3);
 background-image: linear-gradient(top, #0483a0, #31b2c3);
} 
  
.form-wrapper #submit:active {
 outline: 0;    
 -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
 -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;    
}
  
.form-wrapper #submit::-moz-focus-inner {
 border: 0;
}



  • Tạo một HTML/Jaavascript và dán code sau vào:
<form action='/search' class="form-wrapper">
 <input name='q' onblur='if (this.value == &quot;&quot;) {this.value = &quot;Search...&quot;;}' onfocus='if (this.value == &quot;Search...&quot;) {this.value = &quot;&quot;;}' type="text" id="search" placeholder="Search..." required />
 <input type="submit" value="go" id="submit" />
</form>


Một số giá trị Weight em để auto cho nó phù hợp với sidebar, nếu sidebar của mọi người lớn hơn thì nên chỉnh sửa lại cho đẹp, nếu không thì cũng chẳng chết ai.
Việc tạo Widget để cho khi add Search Form được thuận tiện hơn, nếu không thì ta có thể chèn thẳng vào Mẫu luôn.
Chúc thành công!

Comments

  1. Mấy cái này giờ dùng CSS3 rất nhanh gọn và nhẹ

    ReplyDelete
  2. Đúng đấy bác (h), và khi nào html5 phổ biến nữa thì adobe flash sạt nghiệp :d

    ReplyDelete
  3. Haizz... Công nghệ là thứ dễ lỗi thời nhất b-(

    ReplyDelete
  4. Cảm ơn vì bạn đã quan tâm đến blog :))

    ReplyDelete
  5. Có thể dùng 1 lân vào tiện ích thì hay quá

    ReplyDelete
  6. hi, đẹp đó bạn, mà blog của bạn cũng đẹp nữa

    ReplyDelete

Post a Comment

Popular posts from this blog

Leveraging the Fast TikTok API on Apify for Efficient Data Scraping

Introduction: In the world of social media data analysis, TikTok has emerged as a popular platform with a vast amount of user-generated content. To extract valuable insights from TikTok, developers and researchers often resort to web scraping. One efficient way to accomplish this task is by utilizing the Fast TikTok API on the Apify platform. In this article, we will explore the benefits and capabilities of leveraging the Fast TikTok API for data scraping on TikTok. Check the API here:  https://apify.com/novi/fast-tiktok-api

Giải trí với video hài

Hy vọng video này sẽ giúp mọi người thư giãn và xả xì trét :D

Tutorial: Scraping Data from TikTok using Fast TikTok API with Python

In this tutorial, I will guide you through the process of scraping data from TikTok using the Fast TikTok API with Python. We will be using the requests library to make HTTP requests and retrieve data from the API. Let's get started! Step 1: Obtain API Credentials Go to https://apify.com and create an account if you haven't already. Once logged in, navigate to the Fast TikTok API page ( https://apify.com/novi/fast-tiktok-api ). Follow the instructions on the page to obtain your API credentials, such as an API key or access token. Make sure to note down these credentials for future use. Step 2: Set up your Python Environment Ensure that you have Python installed on your system. You can download the latest version of Python from the official website ( https://www.python.org ). Install the requests library by running the following command in your terminal: pip install requests Step 3: Import Required Libraries Open your preferred Python IDE or text editor and create a new Python