The Web Executive

Design

Create a notebook like layout using CSS3 alone

May 22, 2012 by Sreejesh KV in Design, Development with 18 Comments

Using CSS3 gradients instead of images to create backgrounds is a cool technique which offers a lot of flexibility in the design process. If we use images as backgrounds, every time we need a slight update in the background, say, making it a little more lighter in color, we need to take the image file , edit it in photoshop and then replace it. But with the emrgence of this technique, all that we have to do is just edit a few lines in the stylesheet. Pretty time-saving. Isn’t it?

In this tutorial, we will be creating an old note book design by just using CSS alone. No images has been used anywhere in this example.

Final Result

Here is how the output will look like.

HTML

<div
class="note">
<p>
Lorem
ipsum dolor sit amet, consectetur adipiscing elit. Donec quis sem
nec eros viverra ultrices. Suspendisse rutrum dapibus enim, a
lacinia enim malesuada in. <br /> Quisque
sollicitudin, justo at facilisis semper, enim urna ornare dui,
non adipiscing risus ligula ac mauris. Aliquam convallis dapibus
orci a luctus. Cras consequat, massa blandit faucibus sagittis,
diam erat tristique sapien, a aliquet nisi sem sit amet mauris.
Donec euismod facilisis mollis. Phasellus malesuada arcu sed urna
egestas eget lacinia massa pellentesque. Nam scelerisque molestie
fermentum. Nullam sodales iaculis erat, sed venenatis mauris
commodo vel.
</p>

<p>
Praesent
tempor diam eget dui ultricies lobortis. Suspendisse leo leo,
congue sit amet imperdiet vitae, suscipit ac tellus. Nullam
mollis, elit nec laoreet pharetra, urna diam feugiat nisl, a
ultricies diam nisi sit amet erat. Vestibulum ante ipsum primis
in faucibus orci luctus et ultrices posuere cubilia Curae; Duis
id justo eget mauris vulputate eleifend id non quam. Vivamus nisi
nisi, pulvinar ultrices consectetur a, tincidunt nec nisl.
Vivamus eu turpis augue. Fusce sit amet eros non odio consectetur
semper. Phasellus nisl odio, vestibulum pellentesque accumsan
non, facilisis id quam. Mauris ac tellus quis ligula mollis
consectetur vel quis lectus. Suspendisse vestibulum lacinia
tortor, a porttitor turpis blandit non. Vestibulum egestas, massa
in ultricies mollis, enim purus condimentum orci, eu volutpat
ante erat placerat augue. Sed eleifend purus quis metus euismod
eu dapibus metus luctus. Suspendisse suscipit hendrerit odio, non
mollis diam auctor non.

</p>
</div>

CSS

div.note{
width:450px;
padding:2px 15px 15px
60px;
margin:5px;
overflow:hidden;
line-height:20px;
font-size:12px;
color:#2061AF;
text-align:justify;
border:1px
solid #DDD;
box-shadow:3px 3px 5px #ccc;
text-shadow:0 0
3px #8FC2FF;
background:linear-gradient(left, #c42830 0px,
transparent 1px,transparent 3px,#c42830 3px, transparent 4px)
50px 0 repeat-y,
linear-gradient(top, transparent 19px,#2374AC
20px,transparent 20px),
linear-gradient(top, #fff 5px, #fff8e0
20px);
background-size: 100px 20px;
}

div.note
p{
margin:20px 0;
}

Code Explanation

We will use three separate gradients in this example to generate the basic notebook page design.

The first one is used for drawing to closely spaced vertical lines which we will use as the left margin of the notebook.
We will position this gradient 50px from the left side of the page and repeat it over the y-axis so that it covers the entire page-height.

Here is the CSS code to generate this gradient

-moz-linear-gradient(left, #c42830 0px, transparent 1px,transparent 3px,#c42830 3px, transparent 4px) 50px 0 repeat-y

The second gradient is used for drawing the horizontal lines within which is the text content of the page will be enclosed. This is just a single horizontal line which is repeated in both directions.

Here is the gradient-image code

linear-gradient(top, transparent 19px,#2374AC 20px,transparent 20px)

We will set the background-size property to

background-size: 100px 20px;

This will give us a vertical space of 20px between two horizontal lines.

Lastly, the third gradient is used to give an old touch to the paper. You can avoid this step if you think this is unnecessary.

linear-gradient(top, #fff 5px, #fff8e0 20px)

Now we, have to ensure that the text contents of the div will appear only at the desired place.
So we set line-height as 20px and give the div a left-padding. We also need to adjust the paragraph top margin as a multiple of the line-height.

So that is it. You have created an awesome Old notebook design just by using a few lines of css.

Demo

You can view a live demo of this snippet Here

(NB: This example will work on modern browsers only.)




Tagged , , ,

Sharing

Related Posts

18 Comments

  1. Cathy KerrMay 24, 2012 at 8:27 pmReply

    Sreejesh, I have used HTML a little but CSS never!

    Tell me, can you give me simple codes that I can make it on HTML too?? Why I am not copying the code you have given? the reason is since I am not comfortable with the language, I am not sure whether it will be wise for me to use it..
    Cathy Kerr recently posted..insurance marmaladeMy Profile

  2. DynnaLouMay 30, 2012 at 11:58 amReply

    This is definitely a great help and I think every businessman should be aware with this kind of post.. Thanks!
    DynnaLou recently posted..Joe Barrys Panic Away ReviewMy Profile

  3. Sean ColferJune 27, 2012 at 7:06 amReply

    Thanks a lot for sharing. I was actually looking for such code for I want to include a page like that on my blog.
    Sean Colfer recently posted..http://kimkardashiantapenews.com/kim-kardashian-enjoys-being-with-older-man/My Profile

  4. n42kJuly 6, 2012 at 7:23 pmReply

    Woah, this looks impossible to do with CSS3. Thank you for this tutorial, I loved it! The best part is that I don’t need any images so it loads very, very fast. I’m still amazed by how this was done and will have to go through the code some more times, however, I’m sure I’ll understand it after a while. I would appreciate if you could post some more CSS3 tutorials like this!

  5. BreakfreeJuly 13, 2012 at 10:22 pmReply

    I have come across lots of websites with this kind of layout and always wondered how to put it on mine, but on tutorials it seemed rather difficult or not what I was exactly looking for. Thanks for displaying this useful information on how to create this amazing layout. What is more it seems very simple.

  6. DesireeJuly 17, 2012 at 3:01 amReply

    WOW, now this is really cool! It never occurred to me I can produce the good ol’ fashioned paper effect without an image!

    I still have a lot to learn about CSS3 and HTML5, their possibilities are endless.

    Thank you for the great tutorial, I’ll surely use it in one of my next projects.

  7. ollierexxJuly 18, 2012 at 7:40 amReply

    Wow, how is that even possible ? I saw a guy who made one like that in CSS (like the notebook app on Iphones)
    http://puu.sh/Jo97
    Could we just modify the colors and add a background to get a similar effect?

  8. FlipKupJuly 22, 2012 at 11:47 amReply

    That was so easy and well-written. I do not even have to grab my own images to make this possible! Thank you for the great tut, Ill be sure to try this out on my own blog sometimes in the future, a very nice notebook-feel will go well with my posts!

  9. BloomaticAugust 1, 2012 at 8:01 amReply

    Thank you for sharing this code. I haven´t thought yet where I can use, but that style reminds me of the old pieces of paper from school. Maybe I can use it in any project with my students or in a work with similar characteristics. I’ll try to practice it, I think it´s a fun design.

  10. ohiotom76August 14, 2012 at 3:40 amReply

    Very creative use of CSS, I suppose you could even take it a step further and look for a hand written style font on Google web fonts to really make it look organic. Or for a real challenge, it might even be possible to pull off graph paper.

  11. antistarSeptember 3, 2012 at 7:53 amReply

    Really easy-to-use tutorial and really cool outcome too. Thanks so much for sharing! I’ll be trying out this lined paper CSS template for myself soon.

  12. cheaSeptember 10, 2012 at 11:02 amReply

    Hmm… Yeah, I don’t know how many times I had to edit images in Photoshop when I wanted to tweak the design of my sites. Between that and adding content, I was in over my head most days. This is a good idea. It seems to me that using this idea might also speed up page loading, as there won’t be as many images to load.

  13. MatieSeptember 11, 2012 at 10:10 amReply

    Simply amazing, thank you for sharing. It saves you time and kilobytes, especially if you are designing a blog template.

    I find that CSS3 is the most practical version to date, it simplifies things that you don’t necessarilly have to be an specialist to set up a great website.

  14. PaladinOctober 3, 2012 at 5:38 amReply

    I have come across lots of websites with this kind of layout and always wondered how to put it on mine, but on tutorials it seemed rather difficult or not what I was exactly looking for. Thanks for displaying this useful information on how to create this amazing layout. What is more it seems very simple.
    Paladin recently posted..Donator Usergroup Added!My Profile

  15. BrianDouglasOctober 25, 2012 at 6:10 pmReply

    THIS is incredible. I haven’t looked much at all at the new features of CSS3 yet because I haven’t *had* to. However, I see now that I should, and really must. This is awesome.
    BrianDouglas recently posted..3 Adsense Revenue Sharing SitesMy Profile

  16. McColloughNovember 6, 2012 at 9:18 amReply

    OK, this is really neat! Thank you for sharing. I’m an entry level coder myself, and even I found this easy enough to follow. I guess, now I’m going to have to stop using the excuse: “CSS3 is too hard.”

  17. majikstoneNovember 9, 2012 at 6:09 amReply

    Your result is not bad, but I like this one better: http://cssdeck.com/labs/css3-notebook-paper. The only application I could think of for this is an online diary application.

  18. Karen May JonesNovember 29, 2012 at 7:17 amReply

    This is really cute. However, you say it isn’t supported in older browsers. I would not want to use a code that isn’t displayed in older browsers. So, for this simple effect, if I have a need for notebook background, I will stick to using an image for now.

    I will give you an A for effort as this code seems to have made a lot of people happy. Also, I learned about the Yaxis today, so I’m happy about that. I’m a css noob, but I have worked with it in my HTML program’s style sheet creation function.

    Thanks!

Leave a reply

Your email address will not be published. Required fields are marked *

*

CommentLuv badge

Subscribe for our Weekly Digest

Recent Comments
  • Click To See More: Wonderful beat ! I would like to apprentice whilst you amend your website, how can i subscribe for a blog site? The account helped me a applicable deal. I have been a little bit acquainted of this your broadcast offered vibrant transparent idea View Post
  • kayseri rent a car: Great post. I was checking continuously this blog and I am impressed! Very useful info specifically the ultimate phase :) I maintain such information a lot. I was looking for this certain information for a long time. Thank you and best of luck. View Post
  • stybeatty: Продаю акки Liveinternet.ru Продаю автореганные аккаунты Liveinternet.ru в одни руки По всем вопросам пишите сразу в аську ICQ 231538 купить tumbler аккаунты , продажа аккаунтов вконтакте , vkontakte.ru sms украина , купить аккаунты e-mail , магазин аккаунтов facebook , продажа аккаунтов вконтакте онлайн , купить аккаунты вконтакте , продажа аккаунтов одноклассники , 1 google продажа , продам аккаунты facebook , продам аккаунты одноклассники , купить аккаунт pva , город друзья комментарии yahoo hotmail , hotmail интернет магазин , с мгновенной доставкой , продажа аккаунтов вконтакте , магазин продаж аккаунтов , продам аккаунты в контакте , куплю аккаунты в контакте через сервис , продаю редиректы , купить аккаунт liveinternet , онлайн магазин аккаунтов вконтакте , покупка аккаунтов вконтакте с фото , что делать с купить аккаунты liveinternet , продажа аккаунтов yahoo , продам аккаунт livejournal , аккаунты онлайн магазин twitter , редиректы pochta.ru , онлайн магазин аккаунтов вконтакте , купить акаунты hotmail , редиректы pochta.ru , магазин аккаунтов вконтакте , продажа аккаунтов mail.ru , купить аккаунты gmail , продам аккаунты мамба з , продам аккаунты одноклассники , купить почту yahoo , стоимость свежих акков mamba real , liveinternet.ru pinterest , акки от одноклассники , распродажа аккаунтов , gmail купить аккаунты , продам жж аккаунты , продам акки фейсбук , купить mail.ru аккаунты , продам аккаунты facebook , купить facebook pva , продажа аккаунтов yahoo , mamba real status , продажа акков одноклассников , где купить аккаунты facebook , каталог аккаунтов яндекс почты , как найти профиль мамба с помощью номера телефона , с мгновенной доставкой , аккаунты вконтакте купить онлайн , где купит аккаунты View Post
  • Destiny Marietta: Lady Gaga, is an American singer, songwriter, record producer, activist, businesswoman, fashion designer and actress. Born and raised in New York City, she primarily studied at the Convent of the Sacred Heart and briefly attended New York University's Tisch School of the Arts before withdrawing to focus on her musical career. She soon began performing in the rock music scene of Manhattan's Lower East Side. By the end of 2007, record executive and producer Vincent Herbert signed her to his label Streamline Records, an imprint of Interscope Records. Initially working as a songwriter at Interscope Records, her vocal abilities captured the attention of recording artist Akon, who also signed her to Kon Live Distribution, his own label under Interscope.,"^* http://healthmedicinelab.comBye-bye View Post
  • noise cancelling snoring: 5. Hold nasal passages clear View Post
Review www.thewebexecutive.com on alexa.com
DMCA.com The Web Executive - Find me on Bloggers.com