• Vulgar resources html. HTML5 Recipes: Let's dive into coding for HTML5 using specific examples. Policy in the field of communications of the committee’s work with external parties and preservation of documents

    Who in the world is cutest, most blushing and most desirable? Don't think anything vulgar, I mean just a new version of the markup language - HTML5. The latest versions of modern browsers already understand some HTML5 tricks, which means it’s time to start using it in your projects.

    What is HTML5?

    At first glance, HTML5 is just a new version of a markup language. However, now this term means something slightly different. It is simply absurd to consider HTML5 without mentioning CSS3, since it is impossible to do without it to develop truly modern web applications. We can't forget about JavaScript. With its help, access to the rich API described in the HTML5 standard is implemented. Summarizing all of the above, a definition suggests itself: HTML5 is a set of modern technologies/standards (JS, HTML5, CSS3, and so on) used for developing web applications.

    A drop of history

    HTML5 did not appear suddenly. Its development began back in 2007. A specially created group from the W3C consortium was responsible for the work process. But many of the features of HTML5 were invented within the framework of the Web Application 1.0 standard, and they have been poring over it since 2004. So in reality, HTML5 is not such a young technology as it might seem at first glance.

    The first draft of the HTML5 specification became available on January 22, 2008. Three years have passed, but the final version of the specification is still not ready and is unlikely to be ready in the next year or two. This sad moment obliges developers to carefully apply new features in their projects. The specification can easily change, and not all modern browsers (FireFox 4, Google Chrome 10, IE9, Opera 11) fully support the new features.

    Healthy recipes

    We can talk about the theory of HTML5 for a very long time, but our section is called “Coding”, so I invite you to experience the capabilities of the standard in practice. I didn’t bother creating super-original recipes, but decided to give examples of things that are really useful and that can and should be used on your sites right now. So, let's go.

    Recipe No. 1: Turn on Drag&Drop to full

    One of the nice things about HTML5 (you probably shouldn’t have consumed so many energy drinks, because the word “tricks” should be there - editor’s note) of HTML5 was the ability to use the File API and Drag and Drop API.

    With their help, you can organize a beautiful transfer of files from the user’s computer to the server. Remember, before there was always a field with a “Browse” button to send files? After clicking it, a standard file selection dialog appeared, in which you were required to select a file to transfer. It would be hard to call this method convenient. Especially when it comes to adding multiple files to the download queue.

    A little later, craftsmen began to create flash uploaders, which provided greater functionality, but had a serious drawback - the need for an installed flash. In addition, in both cases, the user did not have the ability to add files to transfer by simply dragging the mouse onto the page.

    But Drag&Drop technology is used quite often in the system. Personally, I always wanted to just select the necessary files and throw them onto the page with a slight wave of the rat. This is much more convenient than searching for a file using a standard dialog.

    HTML5 has made its adjustments, and now nothing prevents you from organizing a full-fledged Drag&Drop for transferring a file to a page. Googlers were the first to implement this feature in Gmail. If you use Google, you probably have long noticed the area where you can drag files to attach to a letter. Personally, I actively use this function and now I’ll show you how to create the same one for your project. Our project will consist of three files: sample.html, style.css and scripts.js. We, of course, could limit ourselves to one html file, but then the code would turn out to be unreadable. No need to mix HTML with JS or CSS. It’s better to break everything down into files and then work with them calmly. First of all, let's prepare the structure of our application. Create a file sample.html and write in it:








    Drag your files here



    For the convenience of writing code in JavaScript, I included the jquery library. After that, I described the structure of the future html document. It is simple as hell - we need to describe the field to which the user should drag and drop files. This requires only one div container. If you open the page in a browser now, you won’t see anything good. To make our field visually noticeable, we need to design it using CSS. Open the style.css file and write the following code into it:

    #box (
    width: 500px;
    height: 300px;
    border: 2px dashed #000000;
    background-color: #FCFFB2;
    text-align: center;
    color: #3D91FF;
    font-size: 2em;
    font-family: Verdana, sans-serif;

    Moz-border-radius: 8px;
    -webkit-border-radius: 8px;
    }
    #label (
    position: relative;
    top: 2%;
    }

    The “box” identifier is our future container for receiving files (the user must drag documents to this area). So that the user does not miss, I make the area larger and select dashed - dotted lines - as the framing option. Regular dotted lines don't look very good, so I immediately set the values ​​for the properties: -moz-border-radius and -webkitborderradius. Now you can open the created page in the browser and evaluate the overall appearance.

    However, if you try to drag something now, nothing interesting will happen. The dragged file will simply open in the web browser and that's it. A small piece of JavaScript code will help correct the situation:

    $(document).ready(function() (

    //Add event handlers

    Var mybox = document.getElementById("box")

    Mybox.addEventListener("dragenter", dragEnter, false);

    Mybox.addEventListener("dragexit", dragExit, false);

    Mybox.addEventListener("dragover", dragOver, false);

    Mybox.addEventListener("drop", drop, false);
    });
    function dragEnter(evt) (

    Evt.stopPropagation();

    Evt.preventDefault();
    }
    function dragExit(evt) (

    Evt.stopPropagation();

    Evt.preventDefault();
    }
    function dragOver(evt) (

    Evt.stopPropagation();

    Evt.preventDefault();
    }
    function drop(evt) (

    Evt.stopPropagation();

    Evt.preventDefault();

    Var files = evt.dataTransfer.files;

    Var count = files.length;

    If (count > 0)

    HandleFiles(files);
    }
    function handleFiles(files) (

    //Take the first file

    //If you need to work with several

    //files, then here you need to organize a search

    Var file = files;

    Document.getElementById("label").innerHTML =
    "Caught: " + file.name;

    Var reader = new FileReader();

    Reader.onprogress = handleReaderProgress;

    Reader.readAsDataURL(file);
    }
    function handleReaderProgress(evt) (

    If (evt.lengthComputable) (

    If (evt.loaded = evt.total) (

    Alert("Loaded...");
    }
    }
    }

    At first glance, the code may seem cumbersome and incomprehensible, but those who are at least a little familiar with JavaScript and jquery should immediately understand what is happening. At the very beginning, I identify the events whose occurrence interests me. For each of them I describe a separate function. For example, the dragExit event occurs when the user moves the mouse cursor away from an element that is being dragged. If the user drags a file, the handleFiles() function takes control.

    In it, I deliberately access the very first file (files) and start working with it. Please note that the user can drag and drop several files at once. If your application must be able to handle such situations, then we will organize a search of the entire files array. The handleFiles() function is where all the fun happens.

    First, I display in the label element (remember the inscription “Drag your files here”?) the name of the file that the user dragged onto the active area, and then I begin to read it using an object of the FileReader() type. You can read more about it in this article: html5rocks.com/tutorials/file/dndfiles. Just in case, I define an onProgress event handler for an object of type FileReader(). This event will be called every time a piece of data is read. In the handler itself, I set a condition: if the volume of loaded data is equal to the file size, then the reading has been successfully completed and a happy message can be displayed.

    Recipe No. 2: Drink beer, watch videos, listen to rock

    Before the advent of HTML5, watching videos on the web was carried out using all kinds of flash players. This is not to say that watching videos this way is inconvenient. The only problems there are in security (lately Flash Player is simply teeming with vulnerabilities) and the need to install the plugin itself. The HTML5 standard offers an elegant solution - the built-in ability to play video and audio content.

    Probably, many have already guessed that I am talking about tags and . They allow you to embed audio and video directly into the page. The only disappointment we have to deal with is the set of supported codecs. Unfortunately, this set is different for each browser, so there is a high probability that your video will be displayed perfectly in Chrome, but FireFox users will be left in the woods. To avoid getting into such a situation, it is recommended to take care of the safety net option - playing the video using a Flash player. We talked about cuteness (no, after all, he didn’t mix up the words, he will have to be treated with electroconvulsive therapy for anime addiction - Lozovsky’s note) and problems, now let’s move on to practice. To demonstrate video playback, I threw together a simple example:



    There should be a video here. If you see this text, then your browser does not support the new standard.


    Please note that in the example for the tag I specified the poster attribute. In it I specify the path to the graphic file that should be displayed immediately after the page loads - the “first frame”.

    What can this be useful for? Alternatively, you can insert your company/project logo as such an image. The tag is applied in the same way. It allows you to specify multiple sources for a media file at once. Thus, you can upload the same file in different formats (ogg, mp3). If the user's browser does not have an mp3 codec, an attempt will be made to play ogg. It turns out that with simple manipulations it is easy to solve the compatibility problem and be sure that the user will be able to reproduce the content.

    Recipe #3: Where are you now (geolocation API)

    Geolocation API is a software interface for determining user coordinates. Based on the data obtained, it is easy to mark the user’s location, say, on Google Maps. Where can this feature be used? Yes, many places! For example, the developers of the popular microblogging service Twitter use the Geolocation API in the web interface of the Twitter client. If a user allows their location to be shared, the city in which they are currently located will be added to all of their tweets.

    I have no doubt that now you are tormented by the question: “Where does GAPI get location information from?” Don't even think that spy satellites and other Bond stuff are involved. Everything is much more prosaic - the package of information for analysis is built on the basis of data about the IP address, nearby Wi-Fi hotspots, GPS (if there is a device), GSM cell ID, and so on. If you are interested in the theory and practice of obtaining approximate coordinates from the sources listed above, then I advise you to open the folder ][ and find Step’s article on this topic, where he thoroughly analyzed the theoretical part and also gave an overview of the relevant software. Now let's look at an example of using GAPI. Everything is extremely simple and clear:





    if (navigator.geolocation) (
    navigator.geolocation.getCurrentPosition(
    function (position) (
    document.getElementById("latitude").innerHTML =
    position.coords.latitude;
    document.getElementById("longitude").innerHTML =
    position.coords.longitude;
    },
    );
    }

    Latitude: Unknown

    Longitude: Unknown



    Before attempting to obtain coordinates, you must ensure that your browser supports GAPI. If the geolocation method returned true, then everything is in order and you can try to get the coordinates. To do this, we will use the getGurrentPosition method of the navigator object. If successful, we will receive coordinates that will be sent directly to the document.

    Recipe #4: Database in the Browser

    When developing web applications, we are accustomed to using databases. MySQL, SQLite are products familiar to every programmer. The fifth version of HTML brings us another gift - the ability to use a standalone SQLite database. Stop!

    It turns out that all data will be stored on the user’s computer? Yes, that's right. There is no need to shout that it is unsafe. For certain projects, this feature may well come in handy. Unfortunately, not all browsers allow working with this database yet.

    For example, IE9 and FF4 do not yet have this feature, so you can only get acquainted with the feature in practice in Google Chrome. I will not give an example of real code, but will show only the general principle of operation:

    this.db = openDatabase("xakep", "1.0", "test", 8192);
    tx.executeSql("create mytable if not exists " +
    "checkins(id integer primary key asc, field_number_one string)",
    , function() ( console.log("Request completed successfully"); ));
    );

    Taking a closer look at the above example, you will notice that in general, working with the built-in database occurs in exactly the same way as with regular SQLite: we open the database, prepare the query text and execute it.

    HTML5.Shutdown()

    Whether you use HTML5 in your projects or not is up to you. I think now is the time. If you are a professional website developer, then don’t be lazy to embed HTML5 features now. Of course, do not forget to take care of compatibility - implement support for both modern browsers and outdated ones. You have everything you need for this. Don't slow down and try to make your projects stand out from the rest. Good luck!

    How to insure yourself?

    I've said throughout this article that modern browsers currently support varying degrees of HTML5 functionality. That is why you need to be careful and try not to use very exotic things. The question immediately arises: “How can you find out what HTML5 features a particular browser supports?” There are several ways to solve this problem, but my favorite is to use a tiny JavaScript library called Modernizr (modernizr.com).

    The library is distributed completely free of charge and once you connect it to your project, it will immediately display a list of HTML5 features that your browser supports. To test the functionality of the library, you do not have to immediately download it and connect it to your project. You just need to go to the official library website and you will immediately see what your browser supports and what it doesn’t. Look at the screenshots of visiting the site using Google Chrome and Internet Explorer 9. Despite the good PR campaign and praising articles, the browser from Microsoft clearly supports fewer features than Google Chrome.

    HTML5 will push Flash

    One of the most interesting features of HTML5 is the ability to create animations. This is achieved by mixing HTML5 and CSS3.

    This animation looks quite beautiful and in many cases can replace Flash. I can say with confidence that this will not happen very soon, since now it is easier to master Flash than to understand the obscure HTML5/CSS3 code (IMHO). Nevertheless, you must know about such a feature. I highly recommend that you follow the links below and see with your own eyes the beautiful demos demonstrating the possibility of animation.

    • A beautiful demo showing the capabilities of Canvas: feedtank.com/labs/html_canvas;
    • A beautiful 3D box with a built-in search bar from Google: ;
    • One click and the page will begin to fill with balls. More clicks - more balls. Once you fill the page to the brim, try dragging them sharply. Looks very funny: mrdoob.com/projects/chromeexperiments/ball_pool ;
    • Just an awesome demo showing various chemical compounds. Definitely worth a look: alteredqualia.com/canvasmol;
    • Have you ever wanted to feel like a pathologist and explore the mysteries of the human body?

    If yes, then this link is definitely for you. Google made an excellent demo using a mixture of WebGL, HTML5, CSS3 and Flash technologies. The result of the cocktail was an interactive application demonstrating a 3D human body, in which you can examine the structure of the internal organs. When I saw him for the first time, I couldn’t tear myself away.

    To help you out, we"ve gathered together a selection of resources that will tell you what you need to know, help you when you"re stuck, and get you expanding your skills in no time.

    01. HTML Cheat Sheet

    This incredibly helpful HTML cheat sheet includes a full list of all HTML elements, along with descriptions, code examples and live previews. You can organize the tags alphabetically or by category, and even download it as a PDF to refer to later.

    02. CSS Cheat Sheet

    If you"re just starting out with CSS, simply remembering all the many tags and technical terms can be hugely intimidating. Don"t let that put you off, though; keep this helpful cheat sheet bookmarked, or just print it out, to quickly find the elements you need.

    03. CSS-Tricks

    When it launched in 2007, this site was all about CSS. Now it"s expanded quite a bit, but there"s still plenty of helpful information and tutorials about CSS and HTML for you to get stuck into. It's definitely worth a visit.

    04. CSS Wizardry

    CSS is easy to learn but difficult to master. Harry Roberts" CSS Wizardry has some of the best articles on the nitty-gritty of writing scalable and maintainable CSS, like the BEM methodology and refactoring (which are among the hardest parts).

    05. CodePen's Yearly Top Pens

    One of the best ways to learn HTML/CSS is to dissect cool demos you discover, and CodePen"s yearly Top Pens are great for that. The demos range from cool to "I didn"t even know that was possible". CodePen's integrated UI for diving into the code is also convenient. In a similar vein, you might also like to check out our post.

    06. Web Design Weekly

    HTML and CSS are both constantly evolving. To stay up to date with the latest methodologies and features, we recommend this email newsletter. It comes once a week, which is just often enough that you"ll actually read it.

    07. Responsive Design Weekly

    Responsive is a vital part of the web designer's toolkit these days, and to help you keep up to date, Justin Avery spends hours every week curating the best responsive web design content and interviewing industry leaders, and sends it out as a newsletter every Friday (You might also like our post on .)

    08. Create non-rectangular layouts with CSS shapes

    Last update on November 09 2019 06:54:54 (UTC/GMT +8 hours)

    What is HTML?

    HTML stands for Hyper Text Markup Language is used to create web pages as well as other types of documents viewable in a web browser.

    HTML is a standard specified and maintained by World Wide Web Consortium.

    From its invention, HTML has evolved through different versions. Present version of HTML is HTML 4.01.

    Next version of HTML is HTML 5, which is under development but developers have already started using some of its features.

    In the consequent pages, we will discuss HTML 4.01 in detail. Learning which, you will be able to create web pages by your own.

    HTML code of a simple web page

    An example HTML page This is an example HTML page

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc at nisi velit, aliquet iaculis est. Curabitur porttitor nisi vel lacus euismod egestas. In hac habitasse platea dictumst. In sagittis magna eu odio interdum mollis. Phasellus sagittis pulvinar facilis. Donec vel odio volutpat tortor volutpat commodo. Donec vehicula vulputate sem, vel iaculis urna molestie eget. Sed pellentesque adipiscing tortor, at condimentum elit elementum sed. Mauris dignissim elementum nunc, non elementum felis condimentum eu. In turpis quis erat imperdiet vulputate. Pellentesque mauris turpis, dignissim sed iaculis eu, euismod eget ipsum. Vivamus mollis adipiscing viverra. Morbi at sem eget nisl euismod porta. Sed semper, tortor eu molestie iaculis, felis massa vestibulum massa, vitae suscipit arcu nunc quis ante. Phasellus aliquam elit at nisl condimentum commodo. Nunc congue nibh aliquam enim aliquet nec feugiat diam condimentum. Suspendisse potenti. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam accumsan velit sed lacus pellentesque in gravida nunc ultrices. Aliquam varius scelerisque erat ut egestas.

    Learn HTML from website

    This is an example HTML page

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc at nisi velit, aliquet iaculis est. Curabitur porttitor nisi vel lacus euismod egestas. In hac habitasse platea dictumst. In sagittis magna eu odio interdum mollis. Phasellus sagittis pulvinar facilis. Donec vel odio volutpat tortor volutpat commodo. Donec vehicula vulputate sem, vel iaculis urna molestie eget. Sed pellentesque adipiscing tortor, at condimentum elit elementum sed. Mauris dignissim elementum nunc, non elementum felis condimentum eu. In turpis quis erat imperdiet vulputate. Pellentesque mauris turpis, dignissim sed iaculis eu, euismod eget ipsum. Vivamus mollis adipiscing viverra. Morbi at sem eget nisl euismod porta. Sed semper, tortor eu molestie iaculis, felis massa vestibulum massa, vitae suscipit arcu nunc quis ante. Phasellus aliquam elit at nisl condimentum commodo. Nunc congue nibh aliquam enim aliquet nec feugiat diam condimentum. Suspendisse potenti. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam accumsan velit sed lacus pellentesque in gravida nunc ultrices. Aliquam varius scelerisque erat ut egestas.

    Features of the w3resource HTML tutorials

    We have covered all the HTML 4.01 elements or tags and their attributes. Because it is HTML elements (or tags) and attributes, which you need to understand for learning HTML. While discussing an HTML tag or elements in our HTML tutorials, we have used the following features to help you to understand better:

    1. We have started with a clear and simple description.

    2. We have given a Syntax so that you can remember how to write it.

    3. A Use to show you how to write it in practice.

    4. We have shown the Result of the usage.

    5. Since HTML tags may or may not have and end tag to close the element, we have always shown if Start and end tags are required or not.

    6. In which Category the HTML element belongs to, i.e. if it for text or for heading or for creating forms etc.

    7. Which other elements or what type of content that HTML tag Can contain.

    8. Within which other elements that HTML tag May reside.

    9. Different Attributes of that tag, their description, and examples.

    10. An example of that HTML tag.

    11. The result of that example.

    12. View the example in a browser.

    13. How that tag looks in Different browsers.

    I decided to continue this hot topic. I have compiled a list of the best resources for learning html and css to help those interested in learning these issues. I remember when I started as a webmaster, I really missed such a selection of high-quality and useful resources.

    First some definitions:

    Html (from English "HyperText Markup Language" - hypertext markup language) is a standard markup language for web pages.

    Css (from English "Cascading Style Sheets" - cascading style sheets) is a technology for describing the appearance of a web page.

    Without knowledge of html and css, running your website will be very problematic - you won’t even be able to install a statistics counter or even a banner. Shouldn’t we run to specialists for help or create topic after topic on forums? You just need to take it and learn it.

    From my own experience, I can say that html and css can be learned in 1 month. Of course, I’m not talking about professional heights - you can reach them yourself if you want.

    In my opinion, the best way to learn html, css, and other topics, including website promotion, is to create your own website and practice on it. By the way, you can see the first website I created for maps for the game Counter-Strike, the creation of which I was then keen on. Here are the maps and their screenshots, created by old man Globator in those days when he did not yet know what the top 10, TCI and PR were, and carefreely frolicked in the sun creating three-dimensional maps :) I created this site in a month, learning html and css in practice.

    You don't have to be a technical expert to learn html and css. For example, I am generally a humanist and in mathematics I mostly got a “2” :) So anyone can learn html and css. The resources I have listed are also suitable so that at any time you can use them to find out any point you are interested in regarding html and css.

    Websites for learning html and css

    I’ll start a selection of useful resources for learning html and css from a site that I used myself. These are Wild html lessons written by Valentina Akhmetzyanova aka Dikarka. She described all the necessary points so cheerfully and interestingly that learning html and css with the help of her lessons turns into an exciting activity. By the way, you can read the site for the blog. Wild lessons are enough to learn html and css at the level necessary to work as a webmaster.

    Can you imagine who I would be if I developed further in the topic of Photoshop? I would be a real monster! But I got involved with SEO and vegetate here, typing these letters with fingers cramped from the cold :) Just kidding, it’s also warm here and the food is good :)