Thanks cbVision. I'm really pleased with results, considering this is my first real venture in to CSS layouts.
Point noted regarding use of <br /> tags. I'll go over code again once main design is complete, play around with margins and padding and see if I can reduce usage of these tags.
I removed <style> tag from Codepen, and sure enough font is now displaying correctly thank you.
A problem that has me stumped at present is the centering of legacy You Tube video. I'm using the code you provided, but while the div is centered, the object (video) within that div is aligned to the left, and I can't for the life of me get it centered.
Does a video have to be inside a div and if so, how can I center it please?
Here's the fix:
Basically, you need to convert the object to a block element, then set the margin on that.
And no, it does not have to be in the DIV.
Thanks again cbVision.
With regards to 'Product Description', unfortunately I had to remove all <span> tags, as for some unknown reason my commercial store/ebay platform removes these tag automatically from code?! I've discussed this problem with customer service, and appears it was a conscious decision on the part of the developer to disallow such tags, but they couldn't tell me why exactly. The short and sweet of it is that I've had to use a replacement, and so went with span class.
I've gone back over product description and main template, removing all <br /> where appropriate (which were all but one) and replaced with padded. I went with padding over margin as the contents are already inside a layout, so hope that this is correct? It's created quite a bit more CSS as I had to create more classes etc, and not really sure if I should have used classes or span styles, so may need some optimization.
Here are updated versions, along with how they look on both store and ebay. I haven't touched anything on story design yet, other than making sure the product description displays the same in both store and ebay, as they share the same HTML.
I'm not sure why the bold titles/details line height is so wide here in jsfiddle? Although they are spaced correctly in store and ebay, I have had to use line height of 1.2em for store and 1.7em for ebay to space the same. I thought I'd use px instead to keep it consistent, but even then I have to use different valves to create the same spacing. I read that it's not best practice to use em and px if em is used to specify font size (as is the case here), so opted to return to em for line height as well.
ebay (old code)
ebay (new code)
When you have a space moment cbVision (or anyone else), if you could skim over code and see if any improvements or optimization is needed, that would be much appreciated, thank you.
Again, my week is almost done, so hope you all have a great weekend.
I'm gone over main template and optimized as best I could. I also added graphical div to break up sections such as 'Game Region Codes' and 'Game Conditions'. Is it ok to use a div in this way?
Main Template Optimized
Yep, I think that's fine for handling a divide. You can probably style an HR tag the same way to make it more semantic since that's what HR's are for.
Many thanks! I never knew about the HR tag, so have now changed for div to HR.
With regards to the actual layout of the CSS and HTML code, is there a standard? For example with CSS, should all classes be grouped together, ID's together etc? My CSS code is laid out fairly nicely, so it's easy to find items and edit by just looking at the code, but my HTML code however is a different story and a bit of a mess. When I've tried to make HTML code more presentably, I've often ended up affecting actual output. Because this relates to the actual layout of code, I've found this topic a little difficult to Google, with results only ever relating to actual output, instead of just the code. If there is a standard, could you point me to an example please?
I'm not sure if there's necessarily a "standard." There are definitely some best practices, but it's really up to you to decide what makes most sense with your workflow. I typically like to keep elements together in the same section. For example, I'll have a heading section, footer, left column, content, etc.
Here's a good read:
Good read, thank you, although I must admit a lot of it I found hard to understand, but it did help with organizing my code better.
One thing that did interest me was "Keep a library of helpful CSS classes", although it states that this should only really be used for debugging, but wondering why it couldn't be used for more common things? For example, looking through my code I noticed I use font-weight: bold in four different classes. Would it therefore be a better practice to simply create a 'bold' class and then make use of the using multiple classes for elements? This would cut down on CSS code, although does add another class name to HTML. Some could be done for margin: 0 of which I have in seven different classes.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)