tintim_22 Posted August 10, 2012 at 03:13 PM Report Share #471957 Posted August 10, 2012 at 03:13 PM boas à comunidade... uma duvida parva, consigo que a primeira letra de uma palavra de um novo paragrafo seja maior/outra cor? se sim, como posso fazer para que a mesma possa descer, acompanhando todo o texto do paragrafo? obrigado pela ajuda. =) Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted August 10, 2012 at 03:28 PM Report Share #471958 Posted August 10, 2012 at 03:28 PM podes usar javascript ... exemplo com jquery <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.paragraph').each(function () { var p = $(this).children("p"); var chr = p.html().substr(0, 1); var letter = $(this).children("div"); p.html(p.html().substr(1)); letter.html(chr); }); }); </script> </head> <body> <div class="paragraph" style="width: 200px;"> <div class="first_letter" style="float: left; font-size: 40px; color: red;"></div> <p>texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado</p> </div> <div class="paragraph" style="width: 200px;"> <div class="first_letter" style="float: left; font-size: 40px; color: red;"></div> <p>texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado, texto a ser apresentado</p> </div> </body> </html> IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
mjamado Posted August 10, 2012 at 03:29 PM Report Share #471959 Posted August 10, 2012 at 03:29 PM (edited) Tens que dar um estilo ao pseudo-elemento first-letter do parágrafo. Cuidado, que nem todos os browsers se comportam da mesma forma; testa. p:first-letter { float: left; font-weight: 300%; // não esquecer de ajustar margin e line-height } Edited August 10, 2012 at 03:30 PM by mjamado "Para desenhar um website, não tenho que saber distinguir server-side de client-side" - um membro do fórum que se auto-intitula webdesigner. Temo pelo futuro da web. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now