You can put your CSS rules into an HTML document using the element. This tag is placed inside ... tags. Rules defined using this syntax will be applied to all the elements available in the document.ExampleFollowing is an example of embedded CSS using the element: body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } This is a heading This is a paragraph.
You may need to define multiple style rules for a single element. You can define these rules to combine multiple properties and corresponding values into a single block as defined in the following example: h1 { color: #36C; font-weight: normal; letter-spacing: .4em; margin-bottom: 1em; text-transform: lowercase; }Here all the property and value pairs are separated by a semicolon (;). You can keep them in a single line or multiple lines. For better readability, we keep them on separate lines.
You can define style rules based on the id attribute of the elements. All the elements having that id will be formatted according to the defined rule. #black { color: #000000; }This rule renders the content in black for every element with id attribute set to black in our document. You can make it a bit more particular. For example:h1#black { color: #000000; }This rule renders the content in black for only elements with id attribute set to black.The true power of id selectors is when they are used as the foundation for descendant selectors, For example:#black h2 ... Read More
You can define style rules based on the class attribute of the elements. All the elements having that class will be formatted according to the defined rule..black { color: #808000; }This rule renders the content in black for every element with class attribute set to black in our document. You can make it a bit more particular. For example:h1.black { color: #808000; }This rule renders the content in black for only elements with class attribute set to black.You can apply more than one class selectors to given element. Consider the following example: This para will be ... Read More
Given the task is to show the working of deque::crbegin() in C++.Deque is a double ended queue that gives insertion and deletion at each end i.e. front and back with high performance, in contrast to vector that gives high performance insertion at the end i.e. back only.Also, it provides random access to components too. Though one can insert part in between alternative components in dequeue with insert(), however its performance won't be sensible rather like a vector.What is deque::crbegin()?Deque::crbegin(), where crbegin is the constant reverse begin, implies it constantly reverse the begin or in other words it returns the constant_reverse_iterator.What ... Read More
Except for control characters, (+ ? . * ^ $ ( ) [ ] { } | \), all characters match themselves. You can escape a control character by preceding it with a backslash.Following table lists the regular expression syntax that is available in Python −Sr.No.Pattern & Description1^Matches beginning of line.2$Matches end of line.3.Matches any single character except newline. Using m option allows it to match newline as well.4[...]Matches any single character in brackets.5[^...]Matches any single character not in brackets6re*Matches 0 or more occurrences of preceding expression.7re+Matches 1 or more occurrence of preceding expression.8re?Matches 0 or 1 occurrence of preceding ... Read More
Regular expression literals may include an optional modifier to control various aspects of matching. The modifiers are specified as an optional flag. You can provide multiple modifiers using exclusive OR (|), as shown previously and may be represented by one of these −Sr.No.Modifier & Description1re.IPerforms case-insensitive matching.2re.LInterprets words according to the current locale. This interpretation affects the alphabetic group (\w and \W), as well as word boundary behavior(\b and \B).3re.MMakes $ match the end of a line (not just the end of the string) and makes ^ match the start of any line (not just the start of the string).4re.SMakes ... Read More
One of the most important re methods that use regular expressions is sub.Syntaxre.sub(pattern, repl, string, max=0)This method replaces all occurrences of the RE pattern in string with repl, substituting all occurrences unless max provided. This method returns modified string.Example Live Demo#!/usr/bin/python import re phone = "2004-959-559 # This is Phone Number" # Delete Python-style comments num = re.sub(r'#.*$', "", phone) print "Phone Num : ", num # Remove anything other than digits num = re.sub(r'\D', "", phone) print "Phone Num : ", numOutputWhen the above code is executed, it produces the following result −Phone Num : 2004-959-559 Phone Num : 2004959559Read More
Python offers two different primitive operations based on regular expressions: match checks for a match only at the beginning of the string, while search checks for a match anywhere in the string (this is what Perl does by default).Example Live Demo#!/usr/bin/python import re line = "Cats are smarter than dogs"; matchObj = re.match( r'dogs', line, re.M|re.I) if matchObj: print "match --> matchObj.group() : ", matchObj.group() else: print "No match!!" searchObj = re.search( r'dogs', line, re.M|re.I) if searchObj: print "search --> searchObj.group() : ", searchObj.group() else: print "Nothing found!!"OutputWhen the above code is executed, it produces the following ... Read More
This function searches for first occurrence of RE pattern within string with optional flags.SyntaxHere is the syntax for this function −re.search(pattern, string, flags=0)Here is the description of the parameters −Sr.No.Parameter & Description1patternThis is the regular expression to be matched.2stringThis is the string, which would be searched to match the pattern at the beginning of string.3flagsYou can specify different flags using bitwise OR (|). These are modifiers, which are listed in the table below.The re.search function returns a match object on success, none on failure. We use group(num) or groups() function of match object to get matched expression.Sr.No.Match Object Method & Description1group(num=0)This method returns entire match ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP