Use the border-top property in CSS to set all the top border properties in a single declaration.ExampleYou can try to run the following code to implement the border-top property −Live Demo p { border-style: solid; border-top: thick dashed #FFFF00; } This is demo text
The test() method is a regular expression method. It searches a string for a pattern, and returns true or false, depending on the result. If it encountered the given pattern it returns true, else returns false. It is case sensitive. Let's discuss it in detail.Example-1In the following example, a text named "Tutorix is the best e-learning platform" is given and a pattern "Tu" is checked whether it is present or not. Since the pattern is present the test() method returned true as output.Live Demo Tutorix is the best e-learning platform var text = document.getElementById("text").innerHTML; document.getElementById("test").innerHTML = /Tu/.test(text); ... Read More
To set a style to current link in a navigation bar, add style to .active. You can try to run the following code to style current link:ExampleLive Demo ul { list-style-type: none; margin: 5; padding: 5; } li a { display: block; width: 70px; background-color: #F0E7E7; } .active { background-color: #4CAF50; color: white; } Home Company Product Services Contact
To create a transparent box with CSS, you can try to run the following codeExampleLive Demo div { background-color: #808000; padding: 20px; } div.myopacity { opacity: 0.4; filter: alpha(opacity=80); } Heading Check trensparency in the below box: opacity 0.4 opacity 1
To set the opacity for the background color, use the opacity property with RGBA color values.ExampleYou can try to run the following code to implement the opacity property:Live Demo div { background: rgb(40, 135, 70); padding: 20px; } div.first { background: rgba(40, 135, 70, 0.2); } div.second { background: rgba(40, 135, 70, 0.6); } RGBA color values 20% opacity 60% opacity Default Opacity
To style all visited links, use the CSS :visited selector.ExampleYou can try to run the following code to implement the :visited selectorLive Demo a:link, a:visited { background-color: white; color: black; border: 1px solid blue; padding: 30px 30px; text-align: center; text-decoration: none; display: inline-block; } a:hover, a:active { background-color: red; color: white; } Demo Link
Use the opacity property to add transparency to the background of an element. You can try to run the following code to work.ExampleLive Demo div { background-color: #808000; padding: 20px; } div.one { opacity: 0.2; filter: alpha(opacity=20); } div.two { opacity: 0.5; filter: alpha(opacity=50); } Heading Check transparency in the below section: opacity 0.2 opacity 0.5 opacity 1
Use the CSS : visited selector to style all visited links.ExampleYou can try to run the following code to implement the :visited selector:Live demo a:link, a:visited { background-color: white; color: black; border: 1px solid blue; padding: 30px 30px; text-align: center; text-decoration: none; display: inline-block; } a:hover, a:active { background-color: red; color: white; } Demo Link
The HTML DOM Quote Object represent the element of an HTML document.Let us create q object −SyntaxFollowing is the syntax −document.createElement(“Q”);PropertiesFollowing are the properties of quote object −PropertyExplanationciteIt returns and alter the value of the cite attribute of a quote element in an HTML document.ExampleLet us see an example of HTML DOM quote object − Live Demo body{ text-align:center; background-color:#fff; color:#0197F6; } h1{ color:#23CE6B; } .drop-down{ width:35%; border:2px solid #fff; font-weight:bold; ... Read More
The DOM Script Object represent the element of an HTML document.Create script objectSyntaxFollowing is the syntax −document.createElement(“SCRIPT”);Properties of script objectPropertyExplanationasyncIt returns and alter whether the script should be executed asynchronously or not.charsetIt returns and modify the value of the charset attribute of a script element in an HTML document.deferIt returns and modify the value of the src attribute of a script element in an HTML document.srcIt returns and modify whether the script should be executed when the page has finished parsing.crossOriginIt returns and modify the CORS setting of a script in an HTML document.textIt returns and modify the text ... Read More