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:)
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 months ago.
Improve this question
I'm having issues with my process, since I'm a newbie in HTML-CSS.
The thing is...Whenever I begin my CSS codes I'm having some issues with the
text-align:
font-family
font-size
font-weight
they all seem too similar to me, sometimes I end up doing something that I didn't wanted to.
As an example, in this print
Anyway, I'm taking back all the study I had with CSS so that I can strengthen my knowledge.
I just wanted to share what I'm going through. A lot of things in the CSS seems the same to me and it's confusing!
So text-align determines whether your text is oriented at the left, right, or center of its container, much like the alignment feature on Microsoft Word. Font-family is what kind of font you're using (Arial, Times New Roman, etc.). Font-size is just that, how large your font is, while font-weight determines whether your font is bold or not.
If you want the 2 images to be side by side, rather than one on top of the other, I recommend setting the parent container's display property to flex and its flex-direction to row like this:
.parent-container{
display: flex;
flex-direction: row;
}
You can learn more about Flexbox at https://css-tricks.com/snippets/css/a-guide-to-flexbox/ I found this website invaluable when I was a CSS beginner.
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.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
We all now using table for layout is bad thing. But what's about using table-cell? E.g. i need two blocks one is 200px width and other is 100% - 200px (ye, i know about float hack and also about CSS3 calc).
What you are talking about is for display of a table and table cell. The idea about using tables for layout causes issues with the structure of the page. The CSS property does not affect structure hence there is no issue with using that for visual layout.
While you are right with the notion that using tables for layouts bad... that mostly stems from that additional unnecessary markup. td and tr elements do not provide the correct semantically meaning for what you want.
With that said, there is nothing wrong with applying display: table-cell; on divs, its just another way of structuring layout.
(In fact, table-cell provides one of the few ways to vertically center a div with variable height).
It's an ugly hack, but I don't think there's any problem with it.
The table is discouraged for design because it should hold tabular data - it's semantically wrong to put eg. menu and article in table cells.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a directory page that's pretty simple--a company logo floated to the left, a company title and description on the right. There are about 150 of these, dynamically generated with PHP/MySQL. I recently made the entire site responsive minus the directory page. Right now I'm using tables for the directory which works perfectly. Many of the listings' descriptions vary in length (and therefore height) and using a table allows for the logos to stay perfectly centered with regard to the content.
In an effort to make this page responsive, I've tried to remove the table and rely solely on divs for the directory listings. This has been HELL. Getting an image vertically centered with a variable height on the containing div doesn't seem possible.
I feel like using tables isn't a bad practice in this case, as my data is "tabular" in nature. Am I wrong to assume this, and if not, how can I make the listings table responsive? It's hard for me to fathom being able to do so without changing the HTML (to a div style layout rather than table). Any help would be much appreciated.
You can make divs act like tables, I tend to stay away from tables entirely unless I am asked to code an email blast.
These will be your friends:
display:table;
display:table-cell;
vertical-align:middle;
As long as the images remain inline elements (you have not stated them as display:block) they can be vertically aligned by verical-align:middle and that is out of your way.
I would assume a wrapper class and some child elements with display:inline-block or even table-cell as APAD1 suggest would do the trick, if you can provide some more info we can see it in more detail.
Having said that, your data semantically, imho, would be considered list items and not tabular data and the best way would be to markup-them as li elements.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I feel like this is a very simple problem but I can't seem to wrap my head around it. What I have is a bunch of divs added to a container. Then I want those divs to freely position them self in any white space, but they must move from top to bottom, left to right. I also can not adjust the order of the divs. Here is an example of my problem http://jsfiddle.net/8GMGF/1/. I need the blue box to automatically move into the free space above it. Thanks for any input.
PS. I also tried flexboxes but they don't seem to be able to use free space either. Maybe I missed something.
The result you are looking for (with the subtle tweaks you want to make) might not be possible with pure html and css, you may wish to look into using a tiling plugin such as Masonary for jQuery:
http://masonry.desandro.com/index.html