First of all, <?php post_class(); ?>
function prints a string that contains html 'class'
attribute. So, whenever you are using this function inside class attribute, then you are actually printing another class attribute inside class attribute. That’s why your class is not working.
Secondly, since <?php the_content(); ?>
function may contains <p>
tag, that’s why never use <?php the_content(); ?>
function inside <p>
tag. That will break your style that you wrote for the_content
block. Instead <p>
tag, use <div>
.
So, you may try with this:
<li <?php post_class();?>><?php the_title(); ?></li>
<div <?php post_class(); ?>><?php the_content(); ?></div>
Related Posts:
- How to specify a class added to my gallery
- Is it possible to enqueue a raw CSS string directly from within a template file?
- Get parent category class in post_class()
- Duplicate attribute class causing site validation error
- How do I style WordPress pages differently based on the tag used?
- Inconsistent `body_class()` function
- Output terms to post_class()
- How to create a custom CSS class for a specific page template?
- Getting page output HTML without request (for CriticalCSS, PurgeCSS)
- Using post_class to style posts indivdually
- Hide Overflow on a Specific WordPress Template
- adding additional class to get the post thumbnail [duplicate]
- Vertically align text within a div
- Insert image after each list item
- Change color of PNG image via CSS?
- In CSS what is the difference between “.” and “#” when declaring a set of styles? [duplicate]
- How to completely remove borders from HTML table
- How to fix a footer overlapping content?
- What is element.style and why is it overriding my css settings?
- What’s the HTML to have a horizontal space between two objects?
- Overflow Scroll css is not working in the div
- CSS Div width percentage and padding without breaking layout
- CSS div width not working
- What does the “~” (tilde/squiggle/twiddle) CSS selector mean?
- CSS background-image – What is the correct usage?
- Set bootstrap modal body height by percentage
- Click through div to underlying elements
- How can I fill a div with an image while keeping it proportional?
- Remove top admin bar
- How to add a class to ul tags created by the WordPress editor Tinymce?
- adding a custom css class to post
- Templates & CSS – Proper Programming Practice?
- Using theme options to change link colours
- How to make float element in tinymce
- How to add 10 different css class to posts
- Can “ and “ tags be used in the HTML editor?
- Is there a default style.css
- Add a class to post title if a link ends with a certain extension
- How to get a value for admin css color either gray or blue
- Change color of audio player depending on user role
- Adding external stylesheet after ALL other styles
- How can I use PurifyCSS to clean WordPress style.css?
- WordPress CSS doesn’t update
- Can I install/embed WordPress on a ‘single page’?
- Removing Title From Links to Site
- create bootstrap columns inside editor group block
- Website scroll not working on SAFARI
- Old Site displays on Mobile View, not New Site
- No responsive design is displayed
- Child theme CSS not applying to element
- How to Style Primary Menu with Active Class
- Set 3 iframes in a row
- Google yolo one tab signup plugin avilable in wordpress? [closed]
- Make CSS Changes To Only Affect Mobile Browser [closed]
- Disable File Editing function
- wp_enqueue_scripts and CSS
- User gets access denied to css files and js files even though user is logged in [closed]
- Add second background-image on hover
- CSS getting injected into index from somewhere after theme/custom CSS is loaded, overriding all of my CSS [closed]
- Having a hard time linking my css and JS files on a Boostrap to WP conversion
- How can I add a class to particular paragraphs in my post?
- Reduce font size [closed]
- Page Template Won’t Load Correct CSS File
- Using css class selectors on a specifc page [closed]
- How can I force the WordPress visual editor to preserve the line breaks after paragraphs?
- WordPress Rest Api access the header and extract stylesheets URL
- Login validation on wordpress
- How to create CSS Counters for Comments (depth 5)?
- Navbar bg to overflow to section below (updated)
- Add top parent page id to body class
- Custom post type not pulling CSS
- New Styles Not Rendering On Mobile Phone and Tablet
- Are there any CSS classes for the wordpress colours?
- Set different css stylesheet for specific pages [duplicate]
- Desktop is class List and Mobile is class Grid
- Include ElementorPro css into WordPress custom page
- Customizing the CSS for the post/page editor?
- My Child Theme CSS Isn’t Working
- current menu item hover not working?
- how to load basic wordpress css
- header background color changed after drop & import database in phpmyadmin
- Add class when more page is visited
- How do I make a child theme’s style.css load after plugin css?
- Css style removed but still showing via CDN even after clearing browser cache and purging all caches for site
- Floated element floats into post content in IE, Safari, and Chrome
- Managing large CSS files [closed]
- How would I use a media query to make my entire theme responsive or fluid? [closed]
- Clear white line off page [closed]
- Strange symbols on page [closed]
- background changed after WordPress update
- How to make this splash page responsive
- Menu is not styled properly and footer as well [closed]
- Footer in middle of page in different browers [closed]
- Hiding site title for Twentyfifteen sidebar on (responsive) desktop display size
- Why is the image in div not displayed in full-size?
- How do I add JS and CSS to WP (Flatsome)
- How enqueue CSS out of theme folder?
- Styling not refreshing for old visitors on WordPress
- How to include Elementor CSS in custom php file [closed]
- What is unsafe about this CSS?