Specify Number of Visible Options for Select in HTML

varma
Updated on 01-Jun-2020 08:56:00

82 Views

Use the size attribute to set the number of visible options for element in HTML.ExampleYou can try to run the following code to implement size attribute −           Select the countries you have visited till now,                India          US          Canada          Australia          Bangladesh          

Set Number of Rows a Table Cell Should Span in HTML

Vrundesha Joshi
Updated on 01-Jun-2020 08:50:05

3K+ Views

Use the rowspan attribute to set the number of rows a table cell should span. To merge cells in HTML, use the colspan and rowspan attribute. The rowspan attribute is for number of rows a cell should span, whereas the colspan attribute is for number of columns a cell should span.Example                    table, th, td {             border: 1px solid black;             width: 100px;             height: 50px;          }                     Heading                                                                                                                                                                

Enable Extra Restrictions for Content in an Iframe in HTML

Giri Raju
Updated on 01-Jun-2020 08:49:32

20 Views

Use the sandbox attribute to enable an extra set of restrictions for the content in an in HTML.ExampleYou can try to run the following code to implement sandbox attribute −                    Your browser does not support iframes.          

Display Short Hint for Expected Value in HTML

Daniol Thomas
Updated on 31-May-2020 00:27:36

309 Views

Use the placeholder attribute in HTML to display a hint describing the expected value of the element.ExampleYou can try to run the following code to implement placeholder attribute −           Login                                              

Execute a Script When an Element is Dragged to a Valid Drop Target in HTML

varma
Updated on 31-May-2020 00:20:20

126 Views

When an element has been dragged in HTML to a valid drop target, the ondragenter attribute fires.ExampleYou can try to run the following code to implement the ondragenter attribute −                    #boxA, #boxB {             float:left;padding:10px;margin:10px; -moz-user-select:none;          }          #boxA { background-color: #6633FF; width:75px; height:75px; }          #boxB { background-color: #FF6699; width:150px; height:150px; }                      function dragStart(ev) {             ev.dataTransfer.effectAllowed = 'move';             ev.dataTransfer.setData("Text", ev.target.getAttribute('id'));             ev.dataTransfer.setDragImage(ev.target,0,0);             return true;          }                              Drag and drop HTML5 demo          Try to drag the purple box around.                       Drag Me                    Dustbin          

Specify Multiple Values in HTML

Nishtha Thakur
Updated on 31-May-2020 00:19:32

154 Views

Use the multiple attribute in HTML to specify a user can enter more than one value.ExampleYou can try to run the following code to implement multiple attribute −           Upload multiple files                                  After uploading multiple files, click Submit.                    

Set the Name of the Form Element in HTML

Jennifer Nicholas
Updated on 30-May-2020 23:45:14

140 Views

Use the form attribute in HTML to set the name of the one or more form the element belongs to in HTML.ExampleYou can try to run the following code to implement the form attribute −                    SubjectID:          Subject Name:          Total Students:             Click    

Execute Script on Browser Window Resize in HTML

Daniol Thomas
Updated on 30-May-2020 23:28:32

292 Views

When the web browser window is resized, the onresize attribute triggers.ExampleYou can try to run the following code to implement onresize attribute −           Resize the window to trigger event.                function display() {             alert("Web browser window resized!");          }          

Execute a Script on Mouse Pointer Over an Element in HTML

usharani
Updated on 30-May-2020 23:25:36

360 Views

The onmouseover attribute triggers when a mouse pointer moves over an element in HTML.ExampleYou can try to run the following code to implement onmouseover attribute −                    This is demo heading.             Keep the mouse cursor on the heading to change the color.                function display() {             document.getElementById("myid").style.color = "red";          }          

Display an Image in HTML

Nitya Raut
Updated on 30-May-2020 23:01:27

9K+ Views

Use the tag in HTML to display an image. The following are the attributes −AttributeValueDescriptionAligntopbottommiddleleftrightDeprecated− Specifies the alignment for the image.AlttextSpecifies alternate textBorderpixelsDeprecated − Specifies the width of the image border.crossorigin anonymous use-credentialsIt allows images from third-party sites that allow cross-origin access to be reused with canvas.Heightpixels or %Specifies the height of the image.hspacepixelsDeprecated − Amount of white space to be inserted to the left and right of the object.IsmapURLDefines the image as a server-side image map.LongdesctextDeprecated − Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute.SrcURLthe url ... Read More

Advertisements