I am trying to make a grid layout using flexbox where there are three rows: Header, Content & Footer. Inside the content area I have 2 flex columns.
My desired outcome is to have the header and footer to stay in place and only the main content section (row) scrolls vertically. I am able to achieve this however when I add a scroll-y class to the individual columns I would like the column divs to scroll independently and not the main content. However I can not seem to get this to work. I believe I need to do something with the max-height to the parent div, but any help would be appreciated. I have posted the css I am using and linked to a codepen of a simplified version of what I am looking to accomplish. Thank you in advance.
.full-height {
height: 100vh;
}
.rows {
display: flex;
flex-direction: column;
flex: 1 1 auto;
}
.columns {
display: flex;
flex: 1 1 auto;
}
.row,
column {
display: flex;
padding: 20px;
}
.row.expand {
flex: 1;
max-height: 100%;
}
.column.expand {
flex: 1;
max-witdth: 100%;
}
scroll-no {
overflow: hidden;
}
scroll-y {
overflow-y: auto;
}
https://codepen.io/MrJesseWallace/pen/RwNqQgE?editors=1100
I hope this is what u r expecting check out my answer.
Add these css properties:
.header{
position:fixed;
top:0px;
width:100%;
}
.footer{
position:fixed;
bottom:0px;
width:100%;
}
.columns{
max-height:700px;
overflow:hidden;
}
.scroll-y{
overflow-y:scroll;
}
.header{
position:fixed;
top:0px;
width:100%;
}
.footer{
position:fixed;
bottom:0px;
width:100%;
}
.columns{
max-height:700px;
overflow:hidden;
}
.scroll-y{
overflow-y:scroll;
}
.yellow {
background-color: yellow;
}
.gray {
background-color: lightgray;
}
.full-height {
height: 100vh;
}
.rows {
display: flex;
flex-direction: column;
flex: 1 1 auto;
}
.columns {
display: flex;
flex: 1 1 auto;
}
.row,
column {
display: flex;
padding: 10px;
}
.row.expand {
flex: 1;
max-height: 100%;
}
.column.expand {
flex: 1;
max-witdth: 100%;
}
<div class="rows full-height">
<div class="row yellow header">sss</div>
<div class="row expand gray scroll-y">
<div class="columns">
<div class="column expand scroll-no">
<p>I Should not scroll....</p>
<p>Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps
to outline the visual elements of a document or presentation, eg typography, font, or layout. Lorem ipsum is mostly a part of a Latin text by the classical author and philosopher Cicero. Its words and letters have been changed by addition or
removal, so to deliberately render its content nonsensical; it's not genuine, correct, or comprehensible Latin anymore. While lorem ipsum's still resembles classical Latin, it actually has no meaning whatsoever. As Cicero's text doesn't contain
the letters K, W, or Z, alien to latin, these, and others are often inserted randomly to mimic the typographic appearence of European languages, as are digraphs not to be found in the original. In a professional context it often happens that
private or corporate clients corder a publication to be made and presented with the actual content still not being ready. Think of a news blog that's filled with content hourly on the day of going live. However, reviewers tend to be distracted
by comprehensible content, say, a random text copied from a newspaper or the internet. The are likely to focus on the text, disregarding the layout and its elements. Besides, random text risks to be unintendedly humorous or offensive, an unacceptable
risk in corporate environments. Lorem ipsum and its many variants have been employed since the early 1960ies, and quite likely since the sixteenth century. Lorem Ipsum: common examples layout based on Lorem Ipsum Most of its text is made up
from sections 1.10.32–3 of Cicero's De finibus bonorum et malorum (On the Boundaries of Goods and Evils; finibus may also be translated as purposes). Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
is the first known version ("Neither is there anyone who loves grief itself since it is grief and thus wants to obtain it"). It was found by Richard McClintock, a philologist, director of publications at Hampden-Sydney College in Virginia; he
searched for citings of consectetur in classical Latin literature, a term of remarkably low frequency in that literary corpus. Cicero famously orated against his political opponent Lucius Sergius Catilina. Occasionally the first Oration against
Catiline is taken for type specimens: Quo usque tandem abutere, Catilina, patientia nostra? Quam diu etiam furor iste tuus nos eludet? (How long, O Catiline, will you abuse our patience? And for how long will that madness of yours mock us?)
Cicero's version of Liber Primus (first Book), sections 1.10.32–3 (fragments included in most Lorem Ipsum variants in red): Cicero writing letters; from an early edition by Hieronymus Scotus Sed ut perspiciatis, unde omnis iste natus error sit
voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng] velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut labore
et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit
esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? Lorem Ipsum: translation The Latin scholar H. Rackham translated the above in 1914: De Finibus Bonorum Et Malorum But I must explain to you
how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No
one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or
desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except
to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce
with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those
who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing
prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have
to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. Lorem Ipsum:
variants and technical information Adobe Fireworks Lorem Ipsum plugin In 1985 Aldus Corporation launched its first desktop publishing program Aldus PageMaker for Apple Macintosh computers, released in 1987 for PCs running Windows 1.0. Both contained
the variant lorem ipsum most common today. Laura Perry, then art director with Aldus, modified prior versions of Lorem Ipsum text from typographical specimens; in the 1960s and 1970s it appeared often in lettering catalogs by Letraset. Anecdotal
evidence has it that Letraset used Lorem ipsum already from 1970 onwards, eg. for grids (page layouts) for ad agencies. Many early desktop publishing programs, eg. Adobe PageMaker, used it to create template. Most text editors like MS Word or
Lotus Notes generate random lorem text when needed, either as pre-installed module or plug-in to be added. Word selection or sequence don't necessarily match the original, which is intended to add variety. Presentation software like Keynote
or Pages use it as a samples for screenplay layout. Content management software as Joomla, Drupal, Mambo, PHP-Nuke, WordPress, or Movable Type offer Lorem Ipsum plug-ins with the same functionality.</p>
</div>
<div class="column expand scroll-y">
<p>I Should scroll....</p>
<p>Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps
to outline the visual elements of a document or presentation, eg typography, font, or layout. Lorem ipsum is mostly a part of a Latin text by the classical author and philosopher Cicero. Its words and letters have been changed by addition or
removal, so to deliberately render its content nonsensical; it's not genuine, correct, or comprehensible Latin anymore. While lorem ipsum's still resembles classical Latin, it actually has no meaning whatsoever. As Cicero's text doesn't contain
the letters K, W, or Z, alien to latin, these, and others are often inserted randomly to mimic the typographic appearence of European languages, as are digraphs not to be found in the original. In a professional context it often happens that
private or corporate clients corder a publication to be made and presented with the actual content still not being ready. Think of a news blog that's filled with content hourly on the day of going live. However, reviewers tend to be distracted
by comprehensible content, say, a random text copied from a newspaper or the internet. The are likely to focus on the text, disregarding the layout and its elements. Besides, random text risks to be unintendedly humorous or offensive, an unacceptable
risk in corporate environments. Lorem ipsum and its many variants have been employed since the early 1960ies, and quite likely since the sixteenth century. Lorem Ipsum: common examples layout based on Lorem Ipsum Most of its text is made up
from sections 1.10.32–3 of Cicero's De finibus bonorum et malorum (On the Boundaries of Goods and Evils; finibus may also be translated as purposes). Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
is the first known version ("Neither is there anyone who loves grief itself since it is grief and thus wants to obtain it"). It was found by Richard McClintock, a philologist, director of publications at Hampden-Sydney College in Virginia; he
searched for citings of consectetur in classical Latin literature, a term of remarkably low frequency in that literary corpus. Cicero famously orated against his political opponent Lucius Sergius Catilina. Occasionally the first Oration against
Catiline is taken for type specimens: Quo usque tandem abutere, Catilina, patientia nostra? Quam diu etiam furor iste tuus nos eludet? (How long, O Catiline, will you abuse our patience? And for how long will that madness of yours mock us?)
Cicero's version of Liber Primus (first Book), sections 1.10.32–3 (fragments included in most Lorem Ipsum variants in red): Cicero writing letters; from an early edition by Hieronymus Scotus Sed ut perspiciatis, unde omnis iste natus error sit
voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng] velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut labore
et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit
esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? Lorem Ipsum: translation The Latin scholar H. Rackham translated the above in 1914: De Finibus Bonorum Et Malorum But I must explain to you
how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No
one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or
desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except
to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce
with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those
who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing
prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have
to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. Lorem Ipsum:
variants and technical information Adobe Fireworks Lorem Ipsum plugin In 1985 Aldus Corporation launched its first desktop publishing program Aldus PageMaker for Apple Macintosh computers, released in 1987 for PCs running Windows 1.0. Both contained
the variant lorem ipsum most common today. Laura Perry, then art director with Aldus, modified prior versions of Lorem Ipsum text from typographical specimens; in the 1960s and 1970s it appeared often in lettering catalogs by Letraset. Anecdotal
evidence has it that Letraset used Lorem ipsum already from 1970 onwards, eg. for grids (page layouts) for ad agencies. Many early desktop publishing programs, eg. Adobe PageMaker, used it to create template. Most text editors like MS Word or
Lotus Notes generate random lorem text when needed, either as pre-installed module or plug-in to be added. Word selection or sequence don't necessarily match the original, which is intended to add variety. Presentation software like Keynote
or Pages use it as a samples for screenplay layout. Content management software as Joomla, Drupal, Mambo, PHP-Nuke, WordPress, or Movable Type offer Lorem Ipsum plug-ins with the same functionality. Lorem ipsum is a pseudo-Latin text used in
web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps to outline the visual elements of a document
or presentation, eg typography, font, or layout. Lorem ipsum is mostly a part of a Latin text by the classical author and philosopher Cicero. Its words and letters have been changed by addition or removal, so to deliberately render its content
nonsensical; it's not genuine, correct, or comprehensible Latin anymore. While lorem ipsum's still resembles classical Latin, it actually has no meaning whatsoever. As Cicero's text doesn't contain the letters K, W, or Z, alien to latin, these,
and others are often inserted randomly to mimic the typographic appearence of European languages, as are digraphs not to be found in the original. In a professional context it often happens that private or corporate clients corder a publication
to be made and presented with the actual content still not being ready. Think of a news blog that's filled with content hourly on the day of going live. However, reviewers tend to be distracted by comprehensible content, say, a random text copied
from a newspaper or the internet. The are likely to focus on the text, disregarding the layout and its elements. Besides, random text risks to be unintendedly humorous or offensive, an unacceptable risk in corporate environments. Lorem ipsum
and its many variants have been employed since the early 1960ies, and quite likely since the sixteenth century. Lorem Ipsum: common examples layout based on Lorem Ipsum Most of its text is made up from sections 1.10.32–3 of Cicero's De finibus
bonorum et malorum (On the Boundaries of Goods and Evils; finibus may also be translated as purposes). Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit is the first known version ("Neither is there
anyone who loves grief itself since it is grief and thus wants to obtain it"). It was found by Richard McClintock, a philologist, director of publications at Hampden-Sydney College in Virginia; he searched for citings of consectetur in classical
Latin literature, a term of remarkably low frequency in that literary corpus. Cicero famously orated against his political opponent Lucius Sergius Catilina. Occasionally the first Oration against Catiline is taken for type specimens: Quo usque
tandem abutere, Catilina, patientia nostra? Quam diu etiam furor iste tuus nos eludet? (How long, O Catiline, will you abuse our patience? And for how long will that madness of yours mock us?) Cicero's version of Liber Primus (first Book), sections
1.10.32–3 (fragments included in most Lorem Ipsum variants in red): Cicero writing letters; from an early edition by Hieronymus Scotus Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem
aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem
sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng] velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima
veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem
eum fugiat, quo voluptas nulla pariatur? Lorem Ipsum: translation The Latin scholar H. Rackham translated the above in 1914: De Finibus Bonorum Et Malorum But I must explain to you how all this mistaken idea of denouncing pleasure and praising
pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is
pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally
circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault
with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized
by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying
through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be
welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always
holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. Lorem Ipsum: variants and technical information Adobe Fireworks Lorem Ipsum plugin
In 1985 Aldus Corporation launched its first desktop publishing program Aldus PageMaker for Apple Macintosh computers, released in 1987 for PCs running Windows 1.0. Both contained the variant lorem ipsum most common today. Laura Perry, then
art director with Aldus, modified prior versions of Lorem Ipsum text from typographical specimens; in the 1960s and 1970s it appeared often in lettering catalogs by Letraset. Anecdotal evidence has it that Letraset used Lorem ipsum already from
1970 onwards, eg. for grids (page layouts) for ad agencies. Many early desktop publishing programs, eg. Adobe PageMaker, used it to create template. Most text editors like MS Word or Lotus Notes generate random lorem text when needed, either
as pre-installed module or plug-in to be added. Word selection or sequence don't necessarily match the original, which is intended to add variety. Presentation software like Keynote or Pages use it as a samples for screenplay layout. Content
management software as Joomla, Drupal, Mambo, PHP-Nuke, WordPress, or Movable Type offer Lorem Ipsum plug-ins with the same functionality.</p>
</div>
</div>
</div>
<div class="row yellow footer">ss</div>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i have a lot of content and i am going to upload it to my website, and in website it will look like with no line breaks. and it will take a lot of time to add in content - <br>. Is there any other way to break lines?
Thank you!
I'll assume your original content has breaks caused by carriage returns or line feeds, but they're not rendered that way in your HTML.
To fix that, add CSS style pre-wrap:
div {
white-space: pre-wrap;
}
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
You can give width to paragraph tag or its parent tag. Please post your work in jsfiddle. So i can edit it and give it to you
Use CSS. For instance, if you have several paragraphs of text you can have a space between each one by just giving them a bottom margin as:
p { margin-bottom : 1em; }
That will give a complete blank line between each paragraph (or you could have 0.5em, say, to get half that amount of space, or any other measure. If you haven't used CSS before, now would be the time to learn, and it's pretty easy to learn the basics.
You can add CSS at the top of your HTML in the head section, for now (later learn how to put it into a separate file), doing:
<head>
....[other stuff here]
<style type="text/css">
p { margin-bottom : 1em; }
</style>
</head>
I imagine it would take even longer to wrap paragraphs in <p></p> than it would to add <br> between paragraphs. If I were going to take a huge amount of raw text and put it into content on a web page I would paste it into (or since I am a programmer write a program) a program that would make the conversion.
As I'm writing I'm thinking and wondering if you took your text and put it into MS Word and saved it as an HTML and made the format corrections could you get output from that that would work for your purposes?
I'm looking into using Twitter Bootstrap (with some customisations) for a site rebuild.
One problem is with page/text zooming on Webkit browsers like Chrome and Safari. These don't rewrap the text to the screen when zooming. Instead the text continues off the page requiring horizontal scrolling.
For an example, compare zooming the text on the Bootstrap home page on Chrome/Safari and Firefox - on Firefox even the responsive menubar works properly when there's not enough room for the menu text due to zooming.
This seems to be a known Webkit "feature" with pixel-based layouts, which can be solved by using em-based widths, which looks impractical with the standard Bootstrap (way too much to change and maintain).
So, is there any Bootstrap derivative around which uses em-based widths, or is there any way to add a snippet of css etc to work around the problem? It's the only thing so far stopping me from using Bootstrap on this project. I want the site to be accessible for lower vision users, who often zoom.
Would be nice if Webkit fixed the bug/feature to behave like other browser engines but I don't see that happening anytime soon unfortunately.
[update] Just to be clear, it's the full similar action to Firefox I'm after: zooming text stays constrained within columns, AND media queries realise the space on the screen is limited when text is zoomed and adjust the menu and number of columns accordingly. Fluid layouts help with constraining main article text, but the menus and sidebars are still a mess on Chrome/Safari when zooming.
You can set a slider as accessibility option for lower vision visitors of your site..
Just use text-resizing using jquery. No need to zoom the page.
See this example:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a').click(function() {
var os = $('p').css('font-size');
var num = parseFloat(os, 10);
var px = os.slice(-2);
$('p').css('font-size', num / 1.4 + px);
if (this.id == 'larger') {
$('p').css('font-size', num * 1.4 + px);
}
});
});
</script>
Larger [+]
<br>
Smaller [-]
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
Rob,
You can accomplish what you want by using a fluid container in bootstrap and then setting its max-width property to a percentage width with something like:
[class*="container-"] {
margin: auto;
padding: 0 20px;
max-width: 90%;
}
the html would look something like:
<div class="content">
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
put your contents in here
</div>
</div>
</div>
</div>
Where the div of class content is not within the container and can serve as background. This is how I have my bootstrap site set up and have just tried in safari and firefox with the results you are looking for. As you mentioned the rendering has to do browser's rendering engine (gecko in the case of firefox and webkit in the case of safari). Hope this clears things up for you.
I have a long string, like:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Some of the words should be bold and some text should have another color and so on. Is it somehow possible to give the drawText function a string that already contains the correct syntax so the PDF will have the bold text and so on? Something like this:
$text = "my <b>text</b>...";
$page->drawText($text, 100, ($page->getHeight() - 100));
Its not working with HTML, but something simliar?
Thanks!
The short answer to your question is no, Zend Framework does not provide the formatting functions that you are looking for.
Zend_Pdf provides the primitive functions for drawing text, lines, circles, etc onto the page, but that's about it. If you want to bold some text in the middle of a line, you have to draw the first bit of text, change the font style to bold, draw the bit of text you want bolded, switch back to the original font style and then draw the remainder of the line. And you have to look after line wrapping, page breaks, etc, yourself too.
I wrote a blog post some time ago that talks about these challenges in more depth and have posted a wrapper class on github that makes Zend_Pdf a little easier to use. The post is here: http://yetanotherprogrammingblog.com/content/zend_pdf-wrapper-and-sample-code and the wrapper class is here: https://github.com/jamesggordon/Wrap_Pdf. Unfortunately this version of the class doesn't do precisely what you want, but it shouldn't be too hard to modify the writeText() method to implement the font changing system that you're after.
I too am looking for something similar. We have some legacy code that renders a PDF using Zend PDF.. it's very complicated.
I have in the past used something called DomPDF - this is probably what you need as it just turns HTML into PDF for you - very easy to use!
http://dompdf.github.io/
It can be done, check out zend.pdf.drawing;
http://framework.zend.com/manual/1.12/en/zend.pdf.drawing.html
You'd need to break your PHP strings up, then change the Zend PDF drawing styles between each PHP string.
$style->setFont(\Zend_Pdf_Font::fontWithName(\Zend_Pdf_Font::FONT_TIMES_BOLD), 12);
$page->setStyle($style);
$page->drawText(....);
$style->setFont(\Zend_Pdf_Font::fontWithName(\Zend_Pdf_Font::FONT_TIMES), 10);
$page->setStyle($style);
$page->drawText(....);