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 4 years ago.
Improve this question
Scenario: I have created a class name it pbox with its own border and background and shadow etc. to wrap product image and title . I use the exact same styles for last news to display last news image and title. When I review the website I decide to edit the background color for last news (not for products). When the project is big, I may forget that pbox is used also for products. How do you manage this situation?
1- Produce new class name for every different series of objects? Do you create 20 similar classes when you have 20 different type of content with image and title?
2- produce a new class name when I am editing an existing class and leave the old one unchanged? (even it is not used elsewhere; How do you make sure if this class is used elsewhere?) So do you have a lot of unused classes in your project?
Well you can handle the situation using its parent class like this
Here both product and news block has the same weighed block class pbox
By calling the parent of the news block .news you can edit the background of its child
.pbox{
width:50px;
height:50px;
background:green;
border-radius:7px;
}
.news .pbox{
background:red;
margin-left:15px;
}
div{float:left;}
<div class="products">
<div class="pbox">
</div>
</div>
<div class="news">
<div class="pbox">
</div>
</div>
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 4 years ago.
Improve this question
Is this valid HTML/CSS?
<div>
<div style="display:inline-block; border:1px solid red">
<div style="display:inline-block; padding:5px">Test</div><br />
<div style="display:inline-block; padding:5px">Test</div>
</div>
</div>
i.e. is it considered OK to nest one inline-block inside another? I'm guessing not!
Quote from html validator:
Cases where the default styles are likely to lead to confusion:
Certain elements have default styles or behaviors that make certain
combinations likely to lead to confusion. Where these have equivalent
alternatives without this problem, the confusing combinations are
disallowed.
Examples:
1- <div> inside <span> (block inside inline element)
2- <textarea> inside <button>
If you consider inline-blocks either block or inline element by default, there would be no confusing behavior if you nest inline inside inline or block inside block. The only confusing combination is a block inside the inline element.
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
How can I target an element class with a space before? I am using a Slick carousel slider and it automatically drops in a space in one of my elements I have within.
Example:
<div class=" classwithspace">Read more</div>
Is this still read as
.classwithspace{color:red;}
Taking from the comment of sailens
The space will be not be part of class name, the browser uses the
spaces as separators instead of class parts.
.classwithspace{
background:red;
}
<div class=" classwithspace">Read more</div>
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've been trying to align the P tag text left and right next to each other but can't get it to do so. They are both within the same divs and I'm coding in ems and % could anyone help?
You should use span instead of p which has a default display of inline
<span>Your text here</span>
The p element is default display block. If you insist on using p, then you need to dive into some CSS. Set a class for the p element (or ID if it is unique) like so
<p class="inline-p">Your text here </p>
Then in a separate CSS file, use a selector to reference that class. Please try to avoid inline CSS in your HTML. It can become a nightmare to maintain later.
.inline-p {
// Modify display for this class
display: inline;
}
You should avoid modifying the properties of HTML tags when there is an existing HTML tag that can accomplish what you are looking to do. Nevertheless, both your options are presented here. Good luck with your website.
make display:inline; for p tag
You can't align text left and right in the same p tag unless you use span. But you could do it using the CSS float property
<p style="float: left">Some text on the left</p>
<p style="float: right">Some text on the right</p>
You haven't posted any code for us to analyze, so speaking generally... you can mess with the "display" CSS style and floats to get them lined up as you need, or you could use a more appropriate tag that is already inline, like a span.
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 2 years ago.
Improve this question
IF i use <h2> for left sidebar heading and use <h1> for main center content area heading then actually in source and and if CSS is disabled , in both condition <h2> comes before <h1>.
Is it ok? or i should not use <h2> for left sidebar headings?
Update: 5 Feb
Example image added
Heading Structure http://easycaptures.com/fs/uploaded/235/1182330679.png
Why I'm asking because i always read in many articles <H1> should be the first heading in the page .
alt text http://www.crearecommunications.co.uk/seo-blog/wp-content/uploads/2009/11/heading-subheads.gif
Well, considering the semantics of the h-tags, it is not OK. Your headlines in the finished document should produce a document outline like
1. H1-Head
1.1 H2-Head
1.1.1 H3-Head
1.1.2 H3-Head
...
1.2 H2-Head
1.2.1 H3-Head
...
1.3 H2-Head
...
and so forth.
Of course this outline should conform the chronology of the tag occurences.
Update for your update
I would suggest the following markup
<h1><a>Main title of your site</a></h1>
<h2>Sidebar</h2>
<h3>Sidebar Headline 1</h3>
<h3>Sidebar Headline 2</h3>
....
<h2>Main content</h2>
<h3>Headline 1</h3>
<h3>Headline 2</h3>
...
Do you know the Firefox Web Developer Plugin? It has a function "Show document outline". There you can easily validate the logic of your markup. And to give you an idea, one good and one bad example from pfizer.com and phizer.de (I think you can get the idea, even if it is German - the headlines in red say "Missing Headline").
pfizer.com http://img246.imageshack.us/img246/1336/com.png
pfizer.de http://img96.imageshack.us/img96/1273/74591264.png
By the way: Having all that h-tags in your markup doesn't neccessarily mean that they all have to be visible ;-) !
You should think about it semantically. H1 should come before H2 in a document. H2 is a sub element of H1.
The way I approach a page is to code it in HTML first so that it makes sense to a user without JavaScript and CSS enabledProgressive Enhancement .
Only, then do I worry about styling the content.
probably best option would be to have actually the sidebar after the content in your html and use css to position it where you want.
Semantically, you will want to have the <h2> tags to come after <h1> for the document outline. In this case - does the sidebar really make sense within the flow of the document headers?
From the structure you've described, it seems that the <h2> tag is being used as a header for content that may not be related to the content on a specific page. From a search engine optimization perspective, this may not be optimal if these headers are not actually used in context, but used for the styling.
this article can clarify a bit more: http://www.nathanrice.net/blog/ultimate-guide-to-wordpress-seo-optimized-heading-tags/
From browser's point of view, the order of the tags does not matter. However, the order of the h1 and h2 has semantic implications for the structure of your document. So, having them in the correct order does matter.
Of course, a modern web app does not consist of one document only. There are "external" panels, which are not part of the document (sidebars, panels and so on). Thus, if you want to be semantically "correct", you should reserve h1, h2 and the rest to the main content of your page only, and use div and span for block and inline containers, that do not belong to the semantic structure of your document.
I think people are being pedantic when they say the h1 must come before the h2 in the code. The h1 should be around the most important information on the page whether it is at the top or in the footer.
What is your focus? Are you promoting the company name or what the company does/sells?
I figure if the company is selling 'red widgets', I want 'Red Widgets' to be an h1 on the product page, 'Widgets' to be the h1 on the product listing page and 'We Sell the Best Red, White, and Blue Widgets!' to be the h1 on the home page.
If somebody is looking for 'red widgets', they are usually searching for 'red widgets' and not 'ThisWidgetCompanyName'. The 'ThisWidgetCompanyName' in the title tag will catch anyone searching for the company name and unless there are a lot of companies with the same name, they should pop up near the top.
You can put any HTML tag anywhere you want.
Hello
Hello
Is perfectly fine.