Hi,
I'm currently trying to set something up with HTML/CSS that looks like a post-it note.
An Image of what I'm aiming at
Please note that every line should be underlined, no matter how many characters are in that line. Also every new line should be underlined completely.
HTML:
<p>
<img src="http://trööt.net/img/pin.png" alt="Stecknadel"/>
<font>Heading</font><br />
<span class="blockMargin">
<span class="underline">
<strong>Subheading</strong> text text text
</span>
</span>
</p>
CSS:
p {
background-Color: #ffc;
padding: 1em;
width: 40em;
box-shadow: 5px 5px 3px 0px rgba(119,119,119,0.7);
text-align: justify;
}
img{
float: None;
height: 4em;
display: block;
margin-left: Auto;
margin-right: Auto;
}
.blockMargin{
display: block;
margin-bottom: -1px;
}
.underline{
border-bottom: 1px dotted #c03;
}
This is the code I'm currently using (got the idea already from stackoverflow.com). However, it doesn't underline the lines complete but works exactly like text-decoration: underline
...
Any ideas? Maybe I should add that I create this using WordPress and the Nuclear-Theme.
Thank you very much for your help!
Example on JSFiddle: http://jsfiddle.net/8w9Lj7nd/
To underline a text, you can also use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag, with the CSS property text-decoration.
In the following “Font” dialog box, switch to “Advanced” page. Select “Raised” in the “Position” box, and enter a specific number you want in the “By” box. For example, here we enter “6 pt”. Note that the larger the value we enter, the more space there will be between texts and underline.
There is no CSS for applying an underline ( text-decoration: underline; ) only to individual words in a multiple-word element. The best way would be to wrap each word in a span (not the spaces, just the words) in spans and apply underline to those spans.
Press and hold this keyboard shortcut combination to add multiple underlines next to each other, creating an underline. For example, holding down Ctrl + Shift and pressing the Spacebar five times would create an underline five characters long.
http://jsfiddle.net/8w9Lj7nd/1/
There you go.
.underline{
border-bottom: 1px dotted #c03;
width: 100%;
display: block;
}
This is answered here:
I took the other answer and upgraded it to SCSS to make it configurable. You can now easily change size and color of the holes and rules and everything will size accordingly.
Also, I added another example that uses an editable div instead of a textarea.
jsfiddle
// rule config
$rule-height: 20px; // <-- primary parameter
$font-size: min(max($rule-height - 9, 8pt), 13pt);
$rule-mask-height: $rule-height - 1;
$rule-padding-top: $rule-height + 2;
$rule-padding-right: $rule-height;
$rule-padding-left: $rule-height * 2;
// colors
$hole-fill-color: #f5f5f5;
$hole-shadow: #CCCCCC;
$paper-color: #FFFFFF;
$line-color: #E7EFF8;
Unfortunately, Stackoverflow doesn't support SCSS, so I just included a snapshot of one fixed configuration here:
@import url("https://fonts.googleapis.com/css?family=Reenie+Beanie");
html { height: 100%; }
body { background-color: #f5f5f5; }
.editable {
color: #000000;
border: 1px solid #EEEEEE;
box-shadow: 1px 1px 0 #DDDDDD;
display: inline-block;
vertical-align: top;
/*font-family: 'Marck Script', cursive;*/
font-family: 'Reenie Beanie', cursive;
font-size: 24px;
line-height: 20px;
margin: 2% auto;
padding: 22px 20px 3px 40px;
resize: none;
min-height: 200px;
width: 300px;
background-color: #FFFFFF;
background-image: -moz-linear-gradient(top, transparent, transparent 19px, #E7EFF8 0px), -moz-radial-gradient(4% 50%, circle closest-corner, #f5f5f5, #f5f5f5 39%, transparent 0%), -moz-radial-gradient(3.9% 46%, circle closest-corner, #CCCCCC, #CCCCCC 43.5%, transparent 0%);
background-image: -webkit-linear-gradient(top, transparent, transparent 19px, #E7EFF8 0), -webkit-radial-gradient(4% 50%, circle closest-corner, #f5f5f5, #f5f5f5 39%, transparent 0%), -webkit-radial-gradient(3.9% 46%, circle closest-corner, #CCCCCC, #CCCCCC 43.5%, transparent 0%);
-webkit-background-size: 100% 20px;
background-size: 100% 20px;
}
<textarea class="editable">Textarea: This is the first line.
See, how the text fits here, also if there is a linebreak at the end? It works nicely.
Great.
</textarea>
<div class="editable" contenteditable>Editable div: This is the first line.<br>
See, how the text fits here, also if there is a linebreak at the end?<br>
It works nicely.<br>
<br>
Great.
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With