How to program HTML to create consistent columns for text? [closed] - html

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Iā€™m trying to make it so that the pages of my book can fit into 2 specific column sizes for all the text such that I can click through the pages. Is there any way I can automate it so it detects where exactly in the page it needs to stop and move onto the next?

Ella, your question is very vague. I would suggest as #paulsm4 suggested you study up on html, css and javascript.
Your question does not explain where you are getting the text from, and how it is rendered to the screen. I am going to try and help.
Let's assume you are adding text to a div, your "book" has two pages and so let's assume each page is a div. One on the left and one on the right.
I am going to assume we can use the flex layout so let's use a flexbox.
The css would look something like this.
.book {
display: flex;
}
.page {
flex: 1;
padding: 10px; //just because
border: solid; //so you can see the page
}
The html would be:
<div class="book">
<div id="page1" class="page"></div>
<div id="page1" class="page"></div>
</div>
You could use css to make the min-height of the book 100% so that it spans the entire page. I have added an ID to each of the pages so that you can use javascript to find out how big the div block is.
The javascript would be something like this,
var width = document.getElementById('page1').offsetWidth;
var height = document.getElementById('page2').offsetHeight;
Now with simple maths width x height we have the area. But now we have a problem. What is the font size and type of font you are using. If you have a fixed width font then this is easy if you have a variable width font, then you may have a problem. But in essence, using the size of a letter you could workout by taking the area of the div divided by the area of a letter and you will know how many letters and punctuation can fit in the div.
Alternatively, and a little more complex, but an approach I would use, would be to add words to the div, until the div is larger than a predetermined height. When this happens, remove the previous word and add words to the next div. This can be done using javascript. I would suggest instead of pure javascript that you use a framework such as react, or angular.
Your question however lacks loads of information. In future, please provide some source code to show what you have done, how you are fetching the words and how you are rendering them.
I suggest you take a Udemy course and learn a little more about html, javascript and css. See here.

Related

What's content wrapper in CSS? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I've just stumbled upon this term/method of coding while learning CSS and from what I can understand the "content wrapper" is just a way to center align content of an html element within a container (specifically using a div element). I am not certain on the believability of this information, and would like someone to help further justify this please!
I believe the term is not standardized in any way and it is mainly about semantics. In general it is being used for elements containing some information or grouping several pieces of content together.
For me it is almost the same like container, just more related to the content. So it can be for example the central part of page (between header or footer) or the column with the article.
To simply say, content wrapper holds all visual elements and content on the page. Yes, it centers the content inside the <div> element which is conventionally used when using a content wrapper, but it's also opinionated.
This is normally achieved by using margins, and the most common way of using a content wrapper; eg:
.wrapper {
margin-right: auto;
margin-left: auto;
max-width: 960px;
// Or set a padding inside of the wrapper
padding-right: 10px;
padding-left: 10px;
}
Additionally, wrappers are also used for things like applying a sticky footer.
Otherwise, as for the difference between a container which may usually inherit the same properties, usually intends another kind of containment. One that sometimes necessary to implement a behavior or styling of multiple components.
It serves the purpose of grouping elements both semantically and visually.
The terms wrapper and container can also mean the same thing depending on the developer and what they intend. Just remember to use them in the right way.
Your wrapper can take any name you wish since you decide the css selector name. The styles you apply to that selector makes the change. Either center align or left or etc. It is just a convention that developers use. You will get used to the terminology in no time. Or build your own glossary.

CSS: The content of a grid row is overflowing the page [closed]

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 3 years ago.
Improve this question
The Situation
On my website I have a page for people to listen to my music. The page has a grid element with 3 rows: #music-header, #playlist, and #player. The music-header (header) and player (footer) are 60px tall and the content height is determined dynamically with a 1fr value.
The Problem
When the playlist is loaded with songs, it overflows the page. I have overflow-y: scroll set on #playlist, but that has yielded no results.
The Code
I tried for a good 10 minutes to get the HTML snippet to process my website's code to no avail, so instead I'll provide a link to the broken page:
http://hbms.me/#/music
You'll note the list of songs overflows the page. That list is meant to be contained within the #content box.
NOTE: I am currently using Firefox to view the page.
In style.css line 31 check and apply this css, this will fix your problem.
#playlist {
overflow-y: scroll;
height: 544px;
}
Overflow property only will work when you set max-height. So you need to set height for playlist container either using media query or Js. Else, you have to restructure your code to bring the expected view.
A non-ideal solution would be to use javascript:
setInterval(() => {
// get height of #content
// subtract by 120 (the header and footer are both 60px)
// set #playlist height to resulting value
});
But alas, that is extremely inefficient.

How to optimize my css/html webpage? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am working on a (html/css) website to improve my skills but I am not sure if I am doing it the right way, because I have a lot of floats and sizes. I also need help with some css things:
What I have:
What I need:
The red dimensions in the image are the dimensions I've tried to give the objects and which I am not sure if it is the correct way of doing it.
The black words are the things I would like to change, but I am not sure how I can do it in a good way.
All my code:
index.html:
http://pastebin.com/PZZY7bFA
style.css:
http://pastebin.com/HyEdM6qF
reset.css:
http://pastebin.com/gxqWzFHN
I did not post the css code of the navigation menu because it is already working in a correct way.
I would be very happy if anyone can help me.
Regards,
Engin
Well, I don't have that much time right now. But I tell you this:
Your logo is an object wich is an inline element, same as (link) and normal text.
To vertical center inline elements use line-height: ?px; in your css. Set the ? to the height of your header
To vertical center other elements, such as block elements (f.e. div) you can define the parent as a table cell display: table-cell; and assign vertical-align: middle; to your block element. Of course this would also work for inline elements but the first method is easier here, since you don't have to declare the parent as a table-cell.
Anyway, if you really want to design websites you have to get to know all the princeples and behaviors. Check the urls that were just posted and keep learning A LOT!
I hope you can finish the navigation now:)

Boxshadow and spacing wtih CSS and HTML? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem ā€” and include valid code to reproduce it ā€” in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am having 3 issues across two pages:
http://www.easythemepro.com/ - The button at the bottom of the text appears to have quite a bit of space between the text and the button. What code is adding in this extra spacing?
http://www.easythemepro.com/ - The boxshadowing on the page appears to stop right after the button. What do I need to do to make it extend around the entire page?
http://www.easythemepro.com/themes.php - I'm having the same problem with boxshadowing on this page as well, but it is extending a bit further. What needs to be changed to make it extend all the way down?
I've been staring at the same code all day and can't seem to figure out what's happening with these last 3 issues. I know it's problem simple stuff I'm overlooking after having stared at it all for so long...
1)
In your CSS (style.css) on line 201. You have the following rule:
bottom: 0;
Remove this rule.
Setting the position of the button to "bottom: 0;", puts it at the bottom of the parent container. In this case you do not want this.
2)
Set the height of body & html to 100%:
html, body {
height: 100%;
}
Setting the height of body & html to 100% makes them fill 100% of the height as you'd expect!
3)
Inside #wpwrap set your overflow to automatic.
overflow: auto;
This will make sure the contents of #wpwrap do not escape.

PSD to XHTML/CSS Conversion [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
If I have a psd and trying to figure out what is the best diminsions to use for the html conversion what would be best. Just do the psd image size?
I have my site and the page to what my image should look like below.
Website: http://kansasoutlawwrestling.com
Mockup jpg: http://kansasoutlawwrestling.com/assets/images/wrestling.jpg
I went to psd2htmlconverter.com paid 3 bucks and got something but the html and css shows correctly but its not separated like it should be.
http://kansasoutlawwrestling.com/crap/admintemp/testing/index.html
But I'm really trying to work off of the main website css.
Not entirely sure what you're asking, but if you're talking about how to slice the PSD, I wouldn't slice everything at set dimensions. Let the layout dictate where to slice, and try to slice it logically by section, in such a way that reassembling it with HTML/CSS is easy.
Start by mentally diving the layout into sections, e.g. top banner, left column, right column, content area, footer, etc. After sectioning the layout, just start slicing it logically into small or medium sized images.
It might help to create a skeleton in HTML/CSS so you have an idea of how you need to slice the template. This tends to work out well because you're not just slicing it randomly, but rather you're slicing it to fit the skeleton that you created. Obviously, you may need to slice a big image like a top banner into a few parts, but that doesn't really change anything - you're still fitting the sections of the template to the sections of your skeleton.
Here's something I put together really quickly, just to illustrate how to go about slicing the image. I wouldn't use my exact example, but it should point you in the right direction:
That's probably the best advice I can give with the provided information. I'll expand on my answer if you provide more details.
EDIT
Looking at the source on your page, it looks like you just need to float div#middle so the right sidebar doesn't drop below it.
CSS table layouts are really good for this kind of stuff. Give something like this a shot:
<style type="text/css">
#container {
display:table;
border-collapse:collapse;
}
#layout {
display:table-row;
}
#left-sidebar, #right-sidebar, #content {
text-align:left;
display:table-cell;
}
</style>
<div id="container">
<div id="layout">
<div id="left-sidebar">
<!-- left sidebar-->
</div>
<div id="content">
<!-- content -->
</div>
<div id="right-sidebar">
<!-- right sidebar -->
</div>
</div>
</div>
Here are some articles discussing table-based layouts in CSS2:
http://www.sitepoint.com/table-based-layout-is-the-next-big-thing/
http://thinkvitamin.com/design/tables-the-next-evolution-in-css-layout/